[gtk+] css value: No need for atomic refcounting
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css value: No need for atomic refcounting
- Date: Sat, 12 Sep 2015 17:07:04 +0000 (UTC)
commit 9546ce798b34efb8af2f875151fff96d8d0129eb
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 11 19:04:54 2015 -0400
css value: No need for atomic refcounting
We are all in one thread anyway.
gtk/gtkcssvalue.c | 5 +++--
gtk/gtkcssvalueprivate.h | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index ce2315c..7f43e3f 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -48,7 +48,7 @@ _gtk_css_value_ref (GtkCssValue *value)
{
gtk_internal_return_val_if_fail (value != NULL, NULL);
- g_atomic_int_add (&value->ref_count, 1);
+ value->ref_count += 1;
return value;
}
@@ -59,7 +59,8 @@ _gtk_css_value_unref (GtkCssValue *value)
if (value == NULL)
return;
- if (!g_atomic_int_dec_and_test (&value->ref_count))
+ value->ref_count -= 1;
+ if (value->ref_count > 0)
return;
value->class->free (value);
diff --git a/gtk/gtkcssvalueprivate.h b/gtk/gtkcssvalueprivate.h
index 6a5ab70..77dc5c9 100644
--- a/gtk/gtkcssvalueprivate.h
+++ b/gtk/gtkcssvalueprivate.h
@@ -35,7 +35,7 @@ typedef struct _GtkCssValueClass GtkCssValueClass;
/* using define instead of struct here so compilers get the packing right */
#define GTK_CSS_VALUE_BASE \
const GtkCssValueClass *class; \
- volatile gint ref_count;
+ gint ref_count;
struct _GtkCssValueClass {
void (* free) (GtkCssValue *value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]