[glib] g_clear_pointer: use the same static checks than g_clear_object in glib-2-32



commit cbf06d8fa94672496d170c65ed9c328816e7eee0
Author: Xavier Claessens <xavier claessens collabora co uk>
Date:   Mon Apr 30 17:02:06 2012 +0200

    g_clear_pointer: use the same static checks than g_clear_object in glib-2-32

 glib/gmem.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/glib/gmem.h b/glib/gmem.h
index cb250dc..597bfdf 100644
--- a/glib/gmem.h
+++ b/glib/gmem.h
@@ -99,11 +99,12 @@ gpointer g_try_realloc_n  (gpointer	 mem,
 
 #define g_clear_pointer(pp, destroy) \
   G_STMT_START {                                                               \
-    G_STATIC_ASSERT (sizeof (*(pp)) == sizeof (gpointer));                     \
+    G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer));                       \
     /* Only one access, please */                                              \
-    gpointer *_pp = (gpointer *) pp;                                           \
+    gpointer *_pp = (gpointer *) (pp);                                         \
     gpointer _p;                                                               \
                                                                                \
+    (void) (0 ? (gpointer) *(pp) : 0);                                         \
     do                                                                         \
       _p = g_atomic_pointer_get (_pp);                                         \
     while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_pp, _p, NULL)); \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]