Functions

stringpool.h File Reference

String pool API for "pooling" identical strings into references instead of keeping multiple copies around. More...

Go to the source code of this file.

Functions

gchar * stringpool_get (const gchar *str)
 Fetches or allocates a given string from the stringpool.
void stringpool_unref (gchar *str)
 Unreference a pooled string.

Detailed Description

String pool API for "pooling" identical strings into references instead of keeping multiple copies around.

Definition in file stringpool.h.


Function Documentation

gchar* stringpool_get ( const gchar *  str  ) 

Fetches or allocates a given string from the stringpool.

If string already exists in the pool, reference to it is returned. Otherwise, a new string is created in the pool with one reference.

Parameters:
[in] str String to be poolified.
Returns:
Reference to the pooled string, or NULL if the given string was NULL or an error occured.

Definition at line 70 of file stringpool.c.

Referenced by tuple_associate_string(), and tuple_copy_value().

void stringpool_unref ( gchar *  str  ) 

Unreference a pooled string.

When there are no references left, the string is unallocated and removed from the pool.

Parameters:
[in] str Pointer to a string in the pool.

Definition at line 102 of file stringpool.c.

Referenced by tuple_associate_data(), tuple_destroy(), tuple_disassociate(), and tuple_value_destroy().