summaryrefslogtreecommitdiff
path: root/gobject
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2022-11-29 21:35:04 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2022-11-29 21:35:04 +0100
commita89048c4f1f630e38a00946a60a181db6c96521e (patch)
tree542657d7177b4d29354abc745c735fcf975c4851 /gobject
parentc95bf0514cf2474bd88c2753601ce96e4a1bfa00 (diff)
downloadglib-a89048c4f1f630e38a00946a60a181db6c96521e.tar.gz
gobject: Use a while instead of goto to repeat atomic increment
We can use a cleaner solution now that we do not require to init the same value multiple times in the same way.
Diffstat (limited to 'gobject')
-rw-r--r--gobject/gobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 95d3375c4..8308a55b3 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -3871,8 +3871,8 @@ g_object_unref (gpointer _object)
/* may have been re-referenced meanwhile */
old_ref = g_atomic_int_get ((int *)&object->ref_count);
- retry_atomic_decrement2:
- if (old_ref > 1)
+
+ while (old_ref > 1)
{
/* valid if last 2 refs are owned by this call to unref and the toggle_ref */
gboolean has_toggle_ref = OBJECT_HAS_TOGGLE_REF (object);
@@ -3880,7 +3880,7 @@ g_object_unref (gpointer _object)
if (!g_atomic_int_compare_and_exchange_full ((int *)&object->ref_count,
old_ref, old_ref - 1,
&old_ref))
- goto retry_atomic_decrement2;
+ continue;
/* emit all notifications that have been queued during dispose() */
g_object_notify_queue_thaw (object, nqueue);