[Xfce4-commits] <libxfce4util:nick/abi-changes> Remove the slice allocator macros.

Nick Schermer noreply at xfce.org
Thu Jun 16 22:44:01 CEST 2011


Updating branch refs/heads/nick/abi-changes
         to 8e7d4bc2a9e276ec73d1729978736c3b9b741fae (commit)
       from 7a53e7a7235b46ea993fc874062d5e0b445be53f (commit)

commit 8e7d4bc2a9e276ec73d1729978736c3b9b741fae
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.

 libxfce4util/xfce-private.h   |   17 -----------------
 libxfce4util/xfce-rc-simple.c |   12 ++++++------
 2 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/libxfce4util/xfce-private.h b/libxfce4util/xfce-private.h
index c6b3c85..18e3371 100644
--- a/libxfce4util/xfce-private.h
+++ b/libxfce4util/xfce-private.h
@@ -43,23 +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
-
 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