Index: ghash.c =================================================================== RCS file: /cvs/gnome/glib/ghash.c,v retrieving revision 1.17 diff -u -r1.17 ghash.c --- ghash.c 1999/02/24 06:13:35 1.17 +++ ghash.c 2000/09/24 15:42:42 @@ -28,6 +28,8 @@ * MT safe */ +#define GLIB_PLAIN_MEMORY_SYSTEM + #include "glib.h" @@ -67,8 +69,9 @@ G_LOCK_DEFINE_STATIC (g_hash_global); static GMemChunk *node_mem_chunk = NULL; +#ifndef GLIB_PLAIN_MEMORY_SYSTEM static GHashNode *node_free_list = NULL; - +#endif GHashTable* g_hash_table_new (GHashFunc hash_func, @@ -353,6 +356,9 @@ { GHashNode *hash_node; +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + hash_node = g_new (GHashNode, 1); +#else G_LOCK (g_hash_global); if (node_free_list) { @@ -369,6 +375,7 @@ hash_node = g_chunk_new (GHashNode, node_mem_chunk); } G_UNLOCK (g_hash_global); +#endif hash_node->key = key; hash_node->value = value; @@ -380,10 +387,14 @@ static void g_hash_node_destroy (GHashNode *hash_node) { +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + g_free (hash_node); +#else G_LOCK (g_hash_global); - hash_node->next = node_free_list; + hash_node->next = node_free_list; hash_node->key = 0; hash_node->value = 0; node_free_list = hash_node; G_UNLOCK (g_hash_global); +#endif } static void @@ -392,13 +403,22 @@ if (hash_node) { GHashNode *node = hash_node; - + +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + while (node) + { + GHashNode *tmp = node; + node = node->next; + g_free (tmp); + } +#else while (node->next) node = node->next; - + G_LOCK (g_hash_global); node->next = node_free_list; node_free_list = hash_node; G_UNLOCK (g_hash_global); +#endif } } Index: glist.c =================================================================== RCS file: /cvs/gnome/glib/glist.c,v retrieving revision 1.11 diff -u -r1.11 glist.c --- glist.c 1999/02/24 06:13:42 1.11 +++ glist.c 2000/09/24 15:42:42 @@ -28,6 +28,8 @@ * MT safe */ +#define GLIB_PLAIN_MEMORY_SYSTEM + #include "glib.h" @@ -105,6 +107,9 @@ { GList *list; +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + list = g_new (GList, 1); +#else G_LOCK (current_allocator); if (!current_allocator) { @@ -134,6 +139,7 @@ } } G_UNLOCK (current_allocator); +#endif list->next = NULL; list->prev = NULL; @@ -143,6 +149,14 @@ void g_list_free (GList *list) { +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + while (list) + { + GList *tmp = list; + list = list->next; + g_free (tmp); + } +#else if (list) { list->data = list->next; @@ -151,6 +165,7 @@ current_allocator->free_lists = list; G_UNLOCK (current_allocator); } +#endif } void @@ -158,11 +173,15 @@ { if (list) { +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + g_free (list); +#else list->data = NULL; G_LOCK (current_allocator); list->next = current_allocator->free_lists; current_allocator->free_lists = list; G_UNLOCK (current_allocator); +#endif } } Index: gslist.c =================================================================== RCS file: /cvs/gnome/glib/gslist.c,v retrieving revision 1.10.2.1 diff -u -r1.10.2.1 gslist.c --- gslist.c 2000/05/19 08:18:13 1.10.2.1 +++ gslist.c 2000/09/24 15:42:42 @@ -28,6 +28,8 @@ * MT safe */ +#define GLIB_PLAIN_MEMORY_SYSTEM + #include "glib.h" @@ -105,6 +107,9 @@ { GSList *list; +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + list = g_new (GSList, 1); +#else G_LOCK (current_allocator); if (!current_allocator) { @@ -134,6 +139,7 @@ } } G_UNLOCK (current_allocator); +#endif list->next = NULL; @@ -143,6 +149,14 @@ void g_slist_free (GSList *list) { +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + while (list) + { + GSList *tmp = list; + list = list->next; + g_free (tmp); + } +#else if (list) { list->data = list->next; @@ -151,6 +165,7 @@ current_allocator->free_lists = list; G_UNLOCK (current_allocator); } +#endif } void @@ -158,11 +173,15 @@ { if (list) { +#ifdef GLIB_PLAIN_MEMORY_SYSTEM + g_free (list); +#else list->data = NULL; G_LOCK (current_allocator); list->next = current_allocator->free_lists; current_allocator->free_lists = list; G_UNLOCK (current_allocator); +#endif } } Index: gtree.c =================================================================== RCS file: /cvs/gnome/glib/gtree.c,v retrieving revision 1.10.2.1 diff -u -r1.10.2.1 gtree.c --- gtree.c 2000/05/19 08:18:13 1.10.2.1 +++ gtree.c 2000/09/24 15:42:42 @@ -135,6 +135,8 @@ { g_tree_node_destroy (node->right); g_tree_node_destroy (node->left); + node->key = 0; + node->value = 0; G_LOCK (g_tree_global); node->right = node_free_list; node_free_list = node;