mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-06 01:16:17 +01:00
g_clear_pointer: use the same static checks than g_clear_object in glib-2-32
This commit is contained in:
parent
19ac408650
commit
cbf06d8fa9
@ -99,11 +99,12 @@ gpointer g_try_realloc_n (gpointer mem,
|
|||||||
|
|
||||||
#define g_clear_pointer(pp, destroy) \
|
#define g_clear_pointer(pp, destroy) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
G_STATIC_ASSERT (sizeof (*(pp)) == sizeof (gpointer)); \
|
G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \
|
||||||
/* Only one access, please */ \
|
/* Only one access, please */ \
|
||||||
gpointer *_pp = (gpointer *) pp; \
|
gpointer *_pp = (gpointer *) (pp); \
|
||||||
gpointer _p; \
|
gpointer _p; \
|
||||||
\
|
\
|
||||||
|
(void) (0 ? (gpointer) *(pp) : 0); \
|
||||||
do \
|
do \
|
||||||
_p = g_atomic_pointer_get (_pp); \
|
_p = g_atomic_pointer_get (_pp); \
|
||||||
while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_pp, _p, NULL)); \
|
while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_pp, _p, NULL)); \
|
||||||
|
Loading…
Reference in New Issue
Block a user