[glib: 1/4] glib: Various fixes to the return type of atomic functions



commit 81f8d02e4d04e138e2efcb24111201b2b34100ed
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Oct 7 16:21:24 2019 +0100

    glib: Various fixes to the return type of atomic functions
    
    Various places that used atomic functions were using the wrong return
    type. Fix that. This introduces no functional changes.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/deprecated/gthread-deprecated.c | 4 ++--
 glib/gthread.c                       | 4 ++--
 glib/tests/atomic.c                  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/glib/deprecated/gthread-deprecated.c b/glib/deprecated/gthread-deprecated.c
index b0d67df88..237598945 100644
--- a/glib/deprecated/gthread-deprecated.c
+++ b/glib/deprecated/gthread-deprecated.c
@@ -669,7 +669,7 @@ g_static_rec_mutex_get_rec_mutex_impl (GStaticRecMutex* mutex)
   if (!g_thread_supported ())
     return NULL;
 
-  result = g_atomic_pointer_get (&mutex->mutex.mutex);
+  result = (GRecMutex *) g_atomic_pointer_get (&mutex->mutex.mutex);
 
   if (!result)
     {
@@ -680,7 +680,7 @@ g_static_rec_mutex_get_rec_mutex_impl (GStaticRecMutex* mutex)
         {
           result = g_slice_new (GRecMutex);
           g_rec_mutex_init (result);
-          g_atomic_pointer_set (&mutex->mutex.mutex, result);
+          g_atomic_pointer_set (&mutex->mutex.mutex, (GMutex *) result);
         }
 
       G_UNLOCK (g_static_mutex);
diff --git a/glib/gthread.c b/glib/gthread.c
index 66e4a1f66..f8989009a 100644
--- a/glib/gthread.c
+++ b/glib/gthread.c
@@ -682,7 +682,7 @@ gboolean
   volatile gsize *value_location = location;
   gboolean need_init = FALSE;
   g_mutex_lock (&g_once_mutex);
-  if (g_atomic_pointer_get (value_location) == NULL)
+  if (g_atomic_pointer_get (value_location) == 0)
     {
       if (!g_slist_find (g_once_init_list, (void*) value_location))
         {
@@ -718,7 +718,7 @@ void
 {
   volatile gsize *value_location = location;
 
-  g_return_if_fail (g_atomic_pointer_get (value_location) == NULL);
+  g_return_if_fail (g_atomic_pointer_get (value_location) == 0);
   g_return_if_fail (result != 0);
 
   g_atomic_pointer_set (value_location, result);
diff --git a/glib/tests/atomic.c b/glib/tests/atomic.c
index 22cb0ee77..25468b182 100644
--- a/glib/tests/atomic.c
+++ b/glib/tests/atomic.c
@@ -92,7 +92,7 @@ test_types (void)
   g_assert_true (ip == 0);
 
   g_atomic_pointer_set (&gs, 0);
-  vp2 = g_atomic_pointer_get (&gs);
+  vp2 = (gpointer) g_atomic_pointer_get (&gs);
   gs2 = (gsize) vp2;
   g_assert_cmpuint (gs2, ==, 0);
   res = g_atomic_pointer_compare_and_exchange (&gs, 0, 0);


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