mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-04 04:39:20 +02:00
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:
committed by
Alexander Larsson
parent
4f9e04c1d7
commit
c7f80dbb13
34
glib/gnode.c
34
glib/gnode.c
@@ -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)
|
||||
|
Reference in New Issue
Block a user