[Gnucash-changes] r13338 - gnucash/trunk/src/gnome-utils - Use
glib's slice allocator in favor of GMemChunks for glib >= 2.9.
Chris Shoemaker
chris at cvs.gnucash.org
Mon Feb 20 20:24:03 EST 2006
Author: chris
Date: 2006-02-20 20:24:03 -0500 (Mon, 20 Feb 2006)
New Revision: 13338
Trac: http://svn.gnucash.org/trac/changeset/13338
Modified:
gnucash/trunk/src/gnome-utils/gtktreedatalist.c
Log:
Use glib's slice allocator in favor of GMemChunks for glib >= 2.9.
Patch by Andreas Köhler <andi5.py at gmx.net>.
Modified: gnucash/trunk/src/gnome-utils/gtktreedatalist.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gtktreedatalist.c 2006-02-21 00:14:00 UTC (rev 13337)
+++ gnucash/trunk/src/gnome-utils/gtktreedatalist.c 2006-02-21 01:24:03 UTC (rev 13338)
@@ -26,8 +26,11 @@
#include "gtktreedatalist.h"
//CAS:#include "gtkalias.h"
#include <string.h>
+
+#ifndef HAVE_GLIB29
static GMemChunk *tree_chunk = NULL;
#define TREE_CHUNK_PREALLOCS 64
+#endif
/* node allocation
*/
@@ -36,6 +39,9 @@
{
GtkTreeDataList *list;
+#ifdef HAVE_GLIB29
+ list = g_slice_new0 (GtkTreeDataList);
+#else /* !HAVE_GLIB29 */
if (tree_chunk == NULL)
tree_chunk = g_mem_chunk_new ("treedatalist mem chunk",
sizeof (GtkTreeDataList),
@@ -44,6 +50,7 @@
list = g_chunk_new (GtkTreeDataList, tree_chunk);
memset (list, 0, sizeof (GtkTreeDataList));
+#endif
return list;
}
@@ -67,7 +74,11 @@
else if (g_type_is_a (column_headers [i], G_TYPE_BOXED) && tmp->data.v_pointer != NULL)
g_boxed_free (column_headers [i], (gpointer) tmp->data.v_pointer);
+#ifdef HAVE_GLIB29
+ g_slice_free (GtkTreeDataList, tmp);
+#else /* !HAVE_GLIB29 */
g_mem_chunk_free (tree_chunk, tmp);
+#endif
i++;
tmp = next;
}
More information about the gnucash-changes
mailing list