reworked GCC-specific type-safe macro variant into something less verbose,

Fri Dec  2 13:08:58 2005  Tim Janik  <timj@gtk.org>

        * glib/gslice.h (g_slice_free): reworked GCC-specific type-safe macro
        variant into something less verbose, but digestible for gcc-3.4.
This commit is contained in:
Tim Janik 2005-12-02 12:11:34 +00:00 committed by Tim Janik
parent b78b4ee7fe
commit 605fc3d480
4 changed files with 22 additions and 7 deletions

View File

@ -1,3 +1,8 @@
Fri Dec 2 13:08:58 2005 Tim Janik <timj@gtk.org>
* 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 <timj@imendio.com>
* tests/slice-test.c: extended to perform the benchmarking on the old

View File

@ -1,3 +1,8 @@
Fri Dec 2 13:08:58 2005 Tim Janik <timj@gtk.org>
* 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 <timj@imendio.com>
* tests/slice-test.c: extended to perform the benchmarking on the old

View File

@ -1,3 +1,8 @@
Fri Dec 2 13:08:58 2005 Tim Janik <timj@gtk.org>
* 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 <timj@imendio.com>
* tests/slice-test.c: extended to perform the benchmarking on the old

View File

@ -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 {