Change W32 console detection to look at the window, not stdout
[platform/upstream/glib.git] / glib / gmem.h
index e1d88d5..5dcc3f8 100644 (file)
@@ -117,13 +117,12 @@ gpointer g_try_realloc_n  (gpointer        mem,
     /* This assignment is needed to avoid a gcc warning */                     \
     GDestroyNotify _destroy = (GDestroyNotify) (destroy);                      \
                                                                                \
-    (void) (0 ? (gpointer) *(pp) : 0);                                         \
-    do                                                                         \
-      _p = g_atomic_pointer_get (_pp);                                         \
-    while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_pp, _p, NULL)); \
-                                                                               \
-    if (_p)                                                                    \
-      _destroy (_p);                                                           \
+    _p = *_pp;                                                                 \
+    if (_p)                                                                   \
+      {                                                                       \
+        *_pp = NULL;                                                          \
+        _destroy (_p);                                                         \
+      }                                                                        \
   } G_STMT_END
 
 /* Optimise: avoid the call to the (slower) _n function if we can