From 605fc3d4808365c96f397ced1cf9a8206290b82b Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Fri, 2 Dec 2005 12:11:34 +0000 Subject: [PATCH] reworked GCC-specific type-safe macro variant into something less verbose, Fri Dec 2 13:08:58 2005 Tim Janik * glib/gslice.h (g_slice_free): reworked GCC-specific type-safe macro variant into something less verbose, but digestible for gcc-3.4. --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ glib/gslice.h | 14 +++++++------- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e296ce7..0a92998 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Dec 2 13:08:58 2005 Tim Janik + + * glib/gslice.h (g_slice_free): reworked GCC-specific type-safe macro + variant into something less verbose, but digestible for gcc-3.4. + Fri Dec 2 10:55:07 2005 Tim Janik * tests/slice-test.c: extended to perform the benchmarking on the old diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e296ce7..0a92998 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Fri Dec 2 13:08:58 2005 Tim Janik + + * glib/gslice.h (g_slice_free): reworked GCC-specific type-safe macro + variant into something less verbose, but digestible for gcc-3.4. + Fri Dec 2 10:55:07 2005 Tim Janik * tests/slice-test.c: extended to perform the benchmarking on the old diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index e296ce7..0a92998 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +Fri Dec 2 13:08:58 2005 Tim Janik + + * glib/gslice.h (g_slice_free): reworked GCC-specific type-safe macro + variant into something less verbose, but digestible for gcc-3.4. + Fri Dec 2 10:55:07 2005 Tim Janik * tests/slice-test.c: extended to perform the benchmarking on the old diff --git a/glib/gslice.h b/glib/gslice.h index dc0cc2e..09c8a4e 100644 --- a/glib/gslice.h +++ b/glib/gslice.h @@ -40,17 +40,17 @@ void g_slice_free_chain (gsize block_size, #define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type))) /* g_slice_free(type,mem) g_slice_free1 (sizeof (type), mem) */ -#if __GNUC__ >= 2 +#if __GNUC__ >= 2 /* for GCC, define a type-safe variant of g_slice_free() */ -#define g_slice_free(type, mem) ({ \ - static inline void g_slice_free (gsize, type*); \ - while (0) g_slice_free (sizeof (type), mem); \ - g_slice_free1 (sizeof (type), mem); \ +#define g_slice_free(type, mem) ({ \ + void (*g_slice_free) (gsize, type*); \ + while (0) g_slice_free (sizeof (type), mem); \ + g_slice_free1 (sizeof (type), mem); \ }) -#else +#else /* !__GNUC__ */ #define g_slice_free(type, mem) g_slice_free1 (sizeof (type) + (gsize) (type*) 0, mem) /* we go through the extra (gsize)(type*)0 hoop to ensure a known type argument */ -#endif +#endif /* !__GNUC__ */ /* --- internal debugging API --- */ typedef enum { -- 2.7.4