[Xfce4-commits] <libxfce4util:xfce-4.8> Remove the slice allocator macros.
Nick Schermer
noreply at xfce.org
Mon Sep 12 20:50:03 CEST 2011
Updating branch refs/heads/xfce-4.8
to cdbf8715fef493edb857f937b94e837698c42e47 (commit)
from 07e7b8012f4ccf1c38fe32048c20da943cbed34a (commit)
commit cdbf8715fef493edb857f937b94e837698c42e47
Author: Nick Schermer <nick at xfce.org>
Date: Thu Jun 16 20:00:30 2011 +0200
Remove the slice allocator macros.
We already depend on a new-enough glib to use g_slice directly.
(cherry picked from commit 8e7d4bc2a9e276ec73d1729978736c3b9b741fae)
Conflicts:
libxfce4util/xfce-private.h
libxfce4util/xfce-private.h | 39 ---------------------------------------
libxfce4util/xfce-rc-simple.c | 12 ++++++------
2 files changed, 6 insertions(+), 45 deletions(-)
diff --git a/libxfce4util/xfce-private.h b/libxfce4util/xfce-private.h
index 7899d2d..4e1eea8 100644
--- a/libxfce4util/xfce-private.h
+++ b/libxfce4util/xfce-private.h
@@ -43,45 +43,6 @@ G_BEGIN_DECLS
#define _xfce_return_val_if_fail(expr, val) G_STMT_START{ (void)0; }G_STMT_END
#endif
-/* support macros for the slice allocator */
-#if GLIB_CHECK_VERSION(2,10,0)
-#define _xfce_slice_alloc(block_size) (g_slice_alloc ((block_size)))
-#define _xfce_slice_alloc0(block_size) (g_slice_alloc0 ((block_size)))
-#define _xfce_slice_free1(block_size, mem_block) G_STMT_START{ g_slice_free1 ((block_size), (mem_block)); }G_STMT_END
-#define _xfce_slice_new(type) (g_slice_new (type))
-#define _xfce_slice_new0(type) (g_slice_new0 (type))
-#define _xfce_slice_free(type, ptr) G_STMT_START{ g_slice_free (type, (ptr)); }G_STMT_END
-#else
-#define _xfce_slice_alloc(block_size) (g_malloc ((block_size)))
-#define _xfce_slice_alloc0(block_size) (g_malloc0 ((block_size)))
-#define _xfce_slice_free1(block_size, mem_block) G_STMT_START{ g_free ((mem_block)); }G_STMT_END
-#define _xfce_slice_new(type) (g_new (type, 1))
-#define _xfce_slice_new0(type) (g_new0 (type, 1))
-#define _xfce_slice_free(type, ptr) G_STMT_START{ g_free ((ptr)); }G_STMT_END
-#endif
-
-/* avoid trivial g_value_get_*() function calls */
-#ifdef NDEBUG
-#define g_value_get_boolean(v) (((const GValue *) (v))->data[0].v_int)
-#define g_value_get_char(v) (((const GValue *) (v))->data[0].v_int)
-#define g_value_get_uchar(v) (((const GValue *) (v))->data[0].v_uint)
-#define g_value_get_int(v) (((const GValue *) (v))->data[0].v_int)
-#define g_value_get_uint(v) (((const GValue *) (v))->data[0].v_uint)
-#define g_value_get_long(v) (((const GValue *) (v))->data[0].v_long)
-#define g_value_get_ulong(v) (((const GValue *) (v))->data[0].v_ulong)
-#define g_value_get_int64(v) (((const GValue *) (v))->data[0].v_int64)
-#define g_value_get_uint64(v) (((const GValue *) (v))->data[0].v_uint64)
-#define g_value_get_enum(v) (((const GValue *) (v))->data[0].v_long)
-#define g_value_get_flags(v) (((const GValue *) (v))->data[0].v_ulong)
-#define g_value_get_float(v) (((const GValue *) (v))->data[0].v_float)
-#define g_value_get_double(v) (((const GValue *) (v))->data[0].v_double)
-#define g_value_get_string(v) (((const GValue *) (v))->data[0].v_pointer)
-#define g_value_get_param(v) (((const GValue *) (v))->data[0].v_pointer)
-#define g_value_get_boxed(v) (((const GValue *) (v))->data[0].v_pointer)
-#define g_value_get_pointer(v) (((const GValue *) (v))->data[0].v_pointer)
-#define g_value_get_object(v) (((const GValue *) (v))->data[0].v_pointer)
-#endif
-
G_END_DECLS
#endif /* !__XFCE_RC_H__ */
diff --git a/libxfce4util/xfce-rc-simple.c b/libxfce4util/xfce-rc-simple.c
index 27de23a..13bb5e5 100644
--- a/libxfce4util/xfce-rc-simple.c
+++ b/libxfce4util/xfce-rc-simple.c
@@ -144,7 +144,7 @@ simple_add_group (XfceRcSimple *simple,
if (str_is_equal (group->name, name))
return group;
- group = _xfce_slice_new (Group);
+ group = g_slice_new (Group);
group->name = g_string_chunk_insert (simple->string_chunk, name);
group->efirst = NULL;
group->elast = NULL;
@@ -206,7 +206,7 @@ simple_add_entry (XfceRcSimple *simple,
}
/* why you annoying macro, will you stop borking libxfceutil? thanks. DO NOT DO THAT: g_return_val_if_fail (locale == NULL, NULL); */
- entry = _xfce_slice_new (Entry);
+ entry = g_slice_new (Entry);
entry->key = g_string_chunk_insert (simple->string_chunk, key);
entry->value = g_string_chunk_insert (simple->string_chunk, value);
entry->lfirst = NULL;
@@ -263,7 +263,7 @@ simple_add_entry (XfceRcSimple *simple,
if (G_LIKELY (lentry == NULL))
{
/* create new localized entry */
- lentry = _xfce_slice_new (LEntry);
+ lentry = g_slice_new (LEntry);
lentry->locale = g_string_chunk_insert (simple->string_chunk, locale);
lentry->value = g_string_chunk_insert (simple->string_chunk, value);
@@ -567,11 +567,11 @@ simple_entry_free (Entry *entry)
next = lentry->next;
/* release this lentry */
- _xfce_slice_free (LEntry, lentry);
+ g_slice_free (LEntry, lentry);
}
/* release the entry */
- _xfce_slice_free (Entry, entry);
+ g_slice_free (Entry, entry);
}
@@ -593,7 +593,7 @@ simple_group_free (Group *group)
}
/* release the group */
- _xfce_slice_free (Group, group);
+ g_slice_free (Group, group);
}
More information about the Xfce4-commits
mailing list