Actually turn of css value accounting

We need an #undef here. While doing so, make sure
it compiles without warnings when disabled.
This commit is contained in:
Matthias Clasen 2020-01-18 12:10:26 -05:00
parent 92cfc03821
commit a5530caec3

View File

@ -29,7 +29,9 @@ struct _GtkCssValue {
G_DEFINE_BOXED_TYPE (GtkCssValue, _gtk_css_value, _gtk_css_value_ref, _gtk_css_value_unref) 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; static GHashTable *counters;
typedef struct typedef struct
@ -132,13 +134,13 @@ get_accounting_data (const char *class)
return c; return c;
} }
#endif
GtkCssValue * GtkCssValue *
_gtk_css_value_alloc (const GtkCssValueClass *klass, _gtk_css_value_alloc (const GtkCssValueClass *klass,
gsize size) gsize size)
{ {
GtkCssValue *value; GtkCssValue *value;
ValueAccounting *c;
value = g_slice_alloc0 (size); value = g_slice_alloc0 (size);
@ -146,9 +148,13 @@ _gtk_css_value_alloc (const GtkCssValueClass *klass,
value->ref_count = 1; value->ref_count = 1;
#ifdef CSS_VALUE_ACCOUNTING #ifdef CSS_VALUE_ACCOUNTING
c = get_accounting_data (klass->type_name); {
c->all++; ValueAccounting *c;
c->alive++;
c = get_accounting_data (klass->type_name);
c->all++;
c->alive++;
}
#endif #endif
return value; return value;
@ -167,8 +173,6 @@ gtk_css_value_ref (GtkCssValue *value)
void void
gtk_css_value_unref (GtkCssValue *value) gtk_css_value_unref (GtkCssValue *value)
{ {
ValueAccounting *c;
if (value == NULL) if (value == NULL)
return; return;
@ -177,8 +181,12 @@ gtk_css_value_unref (GtkCssValue *value)
return; return;
#ifdef CSS_VALUE_ACCOUNTING #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 #endif
value->class->free (value); value->class->free (value);