[glib: 1/2] gthread: Fix "zero as null pointer" warning



commit be15a60bdae4fe9d0cf8945fa8dd43e888918537
Author: Jason Crain <jason inspiresomeone us>
Date:   Tue Nov 26 22:33:03 2019 -0700

    gthread: Fix "zero as null pointer" warning
    
    When compiling a program using glib with -Wzero-as-null-pointer-constant
    warnings enabled, the compiler warns about this type check in the
    g_once_init_enter macro. Fix by replacing "0" with "NULL".

 glib/gthread.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gthread.h b/glib/gthread.h
index c8761c5e6..375771ad4 100644
--- a/glib/gthread.h
+++ b/glib/gthread.h
@@ -247,7 +247,7 @@ void            g_once_init_leave               (volatile void  *location,
 # define g_once_init_enter(location) \
   (G_GNUC_EXTENSION ({                                               \
     G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer));       \
-    (void) (0 ? (gpointer) *(location) : 0);                         \
+    (void) (0 ? (gpointer) *(location) : NULL);                      \
     (!g_atomic_pointer_get (location) &&                             \
      g_once_init_enter (location));                                  \
   }))


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