Top |
Functions
EPoolv * | e_poolv_new () |
EPoolv * | e_poolv_set () |
const gchar * | e_poolv_get () |
void | e_poolv_destroy () |
Functions
e_poolv_new ()
EPoolv *
e_poolv_new (guint size
);
Create a new EPoolv: a string vector which shares a global string pool. An EPoolv can be used to work with arrays of strings which save memory by eliminating duplicated allocations of the same string.
This is useful when you have a log of read-only strings that do not go away and are duplicated a lot, such as email headers.
e_poolv_set ()
EPoolv * e_poolv_set (EPoolv *poolv
,gint index
,gchar *str
,gint freeit
);
Set a string vector reference. If the caller will no longer be referencing the string, freeit should be TRUE. Otherwise, this will duplicate the string if it is not found in the pool.
e_poolv_get ()
const gchar * e_poolv_get (EPoolv *poolv
,gint index
);
Retrieve a string by index. This could possibly just be a macro.
Since the pool is never freed, this string does not need to be duplicated, but should not be modified.
e_poolv_destroy ()
void
e_poolv_destroy (EPoolv *poolv
);
Free a pooled string vector. This doesn't free the strings from the vector, however.