[gtk/matthiasc/for-master: 5/7] Actually turn of css value accounting



commit a5530caec3648c8cfe3e86e0e2183faf2b073068
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 18 12:10:26 2020 -0500

    Actually turn of css value accounting
    
    We need an #undef here. While doing so, make sure
    it compiles without warnings when disabled.

 gtk/gtkcssvalue.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index f4a1b27d10..2ce73c2cf1 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -29,7 +29,9 @@ struct _GtkCssValue {
 
 G_DEFINE_BOXED_TYPE (GtkCssValue, _gtk_css_value, _gtk_css_value_ref, _gtk_css_value_unref)
 
-#define CSS_VALUE_ACCOUNTING 0
+#undef CSS_VALUE_ACCOUNTING
+
+#ifdef CSS_VALUE_ACCOUNTING
 static GHashTable *counters;
 
 typedef struct
@@ -132,13 +134,13 @@ get_accounting_data (const char *class)
 
   return c;
 }
+#endif
 
 GtkCssValue *
 _gtk_css_value_alloc (const GtkCssValueClass *klass,
                       gsize                   size)
 {
   GtkCssValue *value;
-  ValueAccounting *c;
 
   value = g_slice_alloc0 (size);
 
@@ -146,9 +148,13 @@ _gtk_css_value_alloc (const GtkCssValueClass *klass,
   value->ref_count = 1;
 
 #ifdef CSS_VALUE_ACCOUNTING
-  c = get_accounting_data (klass->type_name);
-  c->all++;
-  c->alive++;
+  {
+    ValueAccounting *c;
+
+    c = get_accounting_data (klass->type_name);
+    c->all++;
+    c->alive++;
+  }
 #endif
 
   return value;
@@ -167,8 +173,6 @@ gtk_css_value_ref (GtkCssValue *value)
 void
 gtk_css_value_unref (GtkCssValue *value)
 {
-  ValueAccounting *c;
-
   if (value == NULL)
     return;
 
@@ -177,8 +181,12 @@ gtk_css_value_unref (GtkCssValue *value)
     return;
 
 #ifdef CSS_VALUE_ACCOUNTING
-  c = get_accounting_data (value->class->type_name);
-  c->alive--;
+  {
+    ValueAccounting *c;
+
+    c = get_accounting_data (value->class->type_name);
+    c->alive--;
+  }
 #endif
 
   value->class->free (value);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]