From: Alexander Larsson Date: Wed, 25 May 2011 09:56:51 +0000 (+0200) Subject: Use g_atomic_pointer_or/and to set datalist flags X-Git-Tag: 2.29.6~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fca330dafa9a77edc58a30b6128eaf466d4a2ba7;p=platform%2Fupstream%2Fglib.git Use g_atomic_pointer_or/and to set datalist flags https://bugzilla.gnome.org/show_bug.cgi?id=650458 --- diff --git a/glib/gdataset.c b/glib/gdataset.c index c2582b9..3408558 100644 --- a/glib/gdataset.c +++ b/glib/gdataset.c @@ -992,16 +992,10 @@ void g_datalist_set_flags (GData **datalist, guint flags) { - gpointer oldvalue; g_return_if_fail (datalist != NULL); g_return_if_fail ((flags & ~G_DATALIST_FLAGS_MASK) == 0); - - do - { - oldvalue = g_atomic_pointer_get (datalist); - } - while (!g_atomic_pointer_compare_and_exchange ((void**) datalist, oldvalue, - (gpointer) ((gsize) oldvalue | flags))); + + g_atomic_pointer_or (datalist, (gsize)flags); } /** @@ -1021,16 +1015,10 @@ void g_datalist_unset_flags (GData **datalist, guint flags) { - gpointer oldvalue; g_return_if_fail (datalist != NULL); g_return_if_fail ((flags & ~G_DATALIST_FLAGS_MASK) == 0); - - do - { - oldvalue = g_atomic_pointer_get (datalist); - } - while (!g_atomic_pointer_compare_and_exchange ((void**) datalist, oldvalue, - (gpointer) ((gsize) oldvalue & ~(gsize) flags))); + + g_atomic_pointer_and (datalist, ~(gsize)flags); } /**