Re: GNOME CVS: glib johnsonm




>Modified files:
>	.              : ChangeLog ghash.c glib.h 
>
>Log message:
>Tue Nov 24 14:05:47 EST 1998	Michael K. Johnson <johnsonm@redhat.com>
>
>* glib.h: added GFreeFunc and g_hash_table_set_key_freefunc()
>prototype.
>* ghash.c: added g_hash_table_set_key_freefunc() implementation.
>Modified the prototypes of the functions g_hash_node_destroy() and
>g_hash_nodes_destroy(), and changed the functions that call them
>to match the new definitions.
>This changes no external interfaces, and should create no binary
>or source incompatibilities.  It does add a member to the
>GHashTable structure.

The point of this change is to be able to do
g_hash_table_insert(table, g_strdup(blah), baz);
and then when you remove that entry later, the key will be freed.
This is useful for tables where all the data is dynamically generated,
not kept in static tables of strings.  It's important to have because
there is no other intrinsic way to free the key.

I did it because I thought I needed it in gnome-linuxconf, but then
realized that because of hysteresis inherent in the design of gnome
frontends, I needed to have the string around separately and might
as well free it myself anyway.  :-)

michaelkjohnson

"Magazines all too frequently lead to books and should be regarded by the
 prudent as the heavy petting of literature."            -- Fran Lebowitz
 Linux Application Development       http://www.redhat.com/~johnsonm/lad/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]