Re: glib 1.2 patch.




Miguel de Icaza <miguel@nuclecu.unam.mx> writes:

> This addresses what was pointed out in bug #928:
> 
> 1999-04-08  Miguel de Icaza  <miguel@nuclecu.unam.mx>
> 
> 	* ghash.c (g_hash_node_destroy): Clear the key and value fields
> 	when the node is destroyed.  From bug report #928:
> 
> 		"This helps a lot when finding leaks in programs.  The
> 		list containers already do the equivalent of this".

I didn't understand this bug report.

The only for an application to add a node to a hash table
is g_hash_table_insert (). g_hash_table_insert () sets
the key and value fields. This just seems like a waste
of (tiny amounts of) CPU cycles to me. 

                                        Owen
 
> Index: ghash.c
> ===================================================================
> RCS file: /debian/home/gnomecvs/glib/ghash.c,v
> retrieving revision 1.17
> diff -u -u -r1.17 ghash.c
> --- ghash.c	1999/02/24 06:13:35	1.17
> +++ ghash.c	1999/04/09 01:37:06
> @@ -381,6 +381,8 @@
>  g_hash_node_destroy (GHashNode *hash_node)
>  {
>    G_LOCK (g_hash_global);
> +  hash_node->key = NULL;
> +  hash_node->value = NULL;
>    hash_node->next = node_free_list;
>    node_free_list = hash_node;
>    G_UNLOCK (g_hash_global);



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