mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
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:
parent
b78b4ee7fe
commit
605fc3d480
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user