summaryrefslogtreecommitdiff
path: root/ghash.c
diff options
context:
space:
mode:
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>2000-04-17 13:23:27 +0000
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>2000-04-17 13:23:27 +0000
commit8c90d7766b1708a8bcb3cb96988b6b7fc92c2e59 (patch)
tree9bf74b09c3cd4b70ab5216e8085c41d3dec24f8f /ghash.c
parent03f9d485c1435c342c936a26626dda440c1911b9 (diff)
downloadglib-8c90d7766b1708a8bcb3cb96988b6b7fc92c2e59.tar.gz
Add configure test for garbage collector friendliness for GLib. If
2000-04-17 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * configure.in, acconfig.h: Add configure test for garbage collector friendliness for GLib. If enabled, ENABLE_GC_FRIENDLY will be defined. * garray.c, ghash.c, glist.c, gmain.c, gmem.c, gnode.c, gqueue.c, gslist.c, gtree.c: If ENABLE_GC_FRIENDLY is defined, NULLify all memory released by the user, but cached by GLib. This lets a garbage collector have a more correct view of the actually used memory.
Diffstat (limited to 'ghash.c')
-rw-r--r--ghash.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/ghash.c b/ghash.c
index 331a1ab2d..adc3b620a 100644
--- a/ghash.c
+++ b/ghash.c
@@ -380,6 +380,12 @@ g_hash_node_new (gpointer key,
static void
g_hash_node_destroy (GHashNode *hash_node)
{
+
+#ifdef ENABLE_GC_FRIENDLY
+ hash_node->key = NULL;
+ hash_node->value = NULL;
+#endif /* ENABLE_GC_FRIENDLY */
+
G_LOCK (g_hash_global);
hash_node->next = node_free_list;
node_free_list = hash_node;
@@ -394,8 +400,19 @@ g_hash_nodes_destroy (GHashNode *hash_node)
GHashNode *node = hash_node;
while (node->next)
- node = node->next;
-
+ {
+#ifdef ENABLE_GC_FRIENDLY
+ node->key = NULL;
+ node->value = NULL;
+#endif /* ENABLE_GC_FRIENDLY */
+ node = node->next;
+ }
+
+#ifdef ENABLE_GC_FRIENDLY
+ node->key = NULL;
+ node->value = NULL;
+#endif /* ENABLE_GC_FRIENDLY */
+
G_LOCK (g_hash_global);
node->next = node_free_list;
node_free_list = hash_node;