Added --disable-mem-pools option.

2000-12-19  Alexander Larsson  <alexl@redhat.com>

	* configure.in:
	Added --disable-mem-pools option.

	* glist.c:
	* gslist.c:
	* gnode.c:
	* gmem.c:
	Disable free list and memory chunks if DISABLE_MEM_POOLS is defined.
This commit is contained in:
Alexander Larsson
2000-12-19 09:35:44 +00:00
committed by Alexander Larsson
parent 4f9e04c1d7
commit c7f80dbb13
17 changed files with 509 additions and 2 deletions

View File

@@ -31,8 +31,13 @@
* MT safe
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "glib.h"
#ifndef DISABLE_MEM_POOLS
/* node allocation
*/
struct _GAllocator /* from gmem.c */
@@ -167,6 +172,35 @@ g_nodes_free (GNode *node)
current_allocator->free_nodes = node;
G_UNLOCK (current_allocator);
}
#else /* DISABLE_MEM_POOLS */
GNode*
g_node_new (gpointer data)
{
GNode *node;
node = g_new0 (GNode, 1);
node->data = data;
return node;
}
static void
g_nodes_free (GNode *root)
{
GNode *node, *next;
node = root;
while (node != NULL)
{
next = node->next;
g_nodes_free (node->children);
g_free (node);
node = next;
}
}
#endif
void
g_node_destroy (GNode *root)