diff options
Diffstat (limited to 'glib/gmem.h')
-rw-r--r-- | glib/gmem.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/glib/gmem.h b/glib/gmem.h index 45671073b..10879d1ea 100644 --- a/glib/gmem.h +++ b/glib/gmem.h @@ -110,16 +110,18 @@ gpointer g_try_realloc_n (gpointer mem, gsize n_blocks, gsize n_block_bytes) G_GNUC_WARN_UNUSED_RESULT; -#if defined(g_has_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 -#define g_clear_pointer(pp, destroy) \ - G_STMT_START { \ - G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ - __typeof__((pp)) _pp = (pp); \ - __typeof__(*(pp)) _ptr = *_pp; \ - *_pp = NULL; \ - if (_ptr) \ - (destroy) (_ptr); \ - } G_STMT_END \ +#if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 +#define g_clear_pointer(pp, destroy) \ + G_STMT_START \ + { \ + G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ + glib_typeof ((pp)) _pp = (pp); \ + glib_typeof (*(pp)) _ptr = *_pp; \ + *_pp = NULL; \ + if (_ptr) \ + (destroy) (_ptr); \ + } \ + G_STMT_END \ GLIB_AVAILABLE_MACRO_IN_2_34 #else /* __GNUC__ */ #define g_clear_pointer(pp, destroy) \ @@ -212,7 +214,7 @@ g_steal_pointer (gpointer pp) /* type safety */ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && !defined(__cplusplus) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_58 -#define g_steal_pointer(pp) ((__typeof__(*pp)) (g_steal_pointer) (pp)) +#define g_steal_pointer(pp) ((glib_typeof (*pp)) (g_steal_pointer) (pp)) #else /* __GNUC__ */ /* This version does not depend on gcc extensions, but gcc does not warn * about incompatible-pointer-types: */ |