[json-glib] core: Remove atomic operations for reference counting
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [json-glib] core: Remove atomic operations for reference counting
- Date: Thu, 28 Jan 2016 09:19:47 +0000 (UTC)
commit 28c7347150d24383114f06457c3a8d5f5d8eab00
Author: Philip Withnall <philip withnall collabora co uk>
Date: Sat Nov 7 18:01:54 2015 +0100
core: Remove atomic operations for reference counting
They are not needed — json-glib is not at all thread safe.
json-glib/json-array.c | 4 ++--
json-glib/json-object.c | 4 ++--
json-glib/json-value.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/json-glib/json-array.c b/json-glib/json-array.c
index b8186e4..af67b4a 100644
--- a/json-glib/json-array.c
+++ b/json-glib/json-array.c
@@ -100,7 +100,7 @@ json_array_ref (JsonArray *array)
g_return_val_if_fail (array != NULL, NULL);
g_return_val_if_fail (array->ref_count > 0, NULL);
- g_atomic_int_add (&array->ref_count, 1);
+ array->ref_count++;
return array;
}
@@ -119,7 +119,7 @@ json_array_unref (JsonArray *array)
g_return_if_fail (array != NULL);
g_return_if_fail (array->ref_count > 0);
- if (g_atomic_int_dec_and_test (&array->ref_count))
+ if (--array->ref_count == 0)
{
guint i;
diff --git a/json-glib/json-object.c b/json-glib/json-object.c
index cc32148..214ffef 100644
--- a/json-glib/json-object.c
+++ b/json-glib/json-object.c
@@ -87,7 +87,7 @@ json_object_ref (JsonObject *object)
g_return_val_if_fail (object != NULL, NULL);
g_return_val_if_fail (object->ref_count > 0, NULL);
- g_atomic_int_add (&object->ref_count, 1);
+ object->ref_count++;
return object;
}
@@ -106,7 +106,7 @@ json_object_unref (JsonObject *object)
g_return_if_fail (object != NULL);
g_return_if_fail (object->ref_count > 0);
- if (g_atomic_int_dec_and_test (&object->ref_count))
+ if (--object->ref_count == 0)
{
g_list_free (object->members_ordered);
g_hash_table_destroy (object->members);
diff --git a/json-glib/json-value.c b/json-glib/json-value.c
index 43ea4dd..b6d47e1 100644
--- a/json-glib/json-value.c
+++ b/json-glib/json-value.c
@@ -109,7 +109,7 @@ json_value_ref (JsonValue *value)
{
g_return_val_if_fail (value != NULL, NULL);
- g_atomic_int_add (&value->ref_count, 1);
+ value->ref_count++;
return value;
}
@@ -119,7 +119,7 @@ json_value_unref (JsonValue *value)
{
g_return_if_fail (value != NULL);
- if (g_atomic_int_dec_and_test (&value->ref_count))
+ if (--value->ref_count == 0)
json_value_free (value);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]