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>
This commit is contained in:
Philip Withnall 2019-10-07 16:21:24 +01:00
parent 4e12e7ed0d
commit 81f8d02e4d
3 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);