[libdazzle] macros: do the Linux check correctly



commit 3054025425b12df32b53a44cce9888a2be9f1eae
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Sun Dec 24 22:22:03 2017 +0800

    macros: do the Linux check correctly
    
    It should be '#ifdef', not '#ifndef'. This commit also fixes a return
    type error in the function.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791922

 src/util/dzl-macros.h |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/util/dzl-macros.h b/src/util/dzl-macros.h
index 5a42f54..5151e39 100644
--- a/src/util/dzl-macros.h
+++ b/src/util/dzl-macros.h
@@ -25,6 +25,7 @@
 #ifdef __linux__
 # include <sys/types.h>
 # include <sys/syscall.h>
+# include <unistd.h>
 #endif
 
 G_BEGIN_DECLS
@@ -88,18 +89,18 @@ static inline void
 dzl_assert_is_main_thread (void)
 {
 #ifndef G_DISABLE_ASSERT
-# ifndef __linux__
-  static GThread *main;
+# ifdef __linux__
+  static GThread *main_thread;
   GThread *self = g_thread_self ();
 
-  if G_LIKELY (main == self)
-    return TRUE;
+  if G_LIKELY (main_thread == self)
+    return;
 
   /* Slow path, rely on task id == process id */
   if ((pid_t)syscall (SYS_gettid) == getpid ())
     {
       /* Allow for fast path next time */
-      main = self;
+      main_thread = self;
       return;
     }
 


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