[gtk+/wip/cssvalue] xxx: arrayvalue
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssvalue] xxx: arrayvalue
- Date: Mon, 2 Apr 2012 09:18:52 +0000 (UTC)
commit b9b46788230ce7be6eb50b6bc2cb7cfc2e11b589
Author: Benjamin Otte <otte redhat com>
Date: Sun Apr 1 06:18:56 2012 +0200
xxx: arrayvalue
gtk/gtkcssarrayvalue.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c
index 0ee775f..34f2e26 100644
--- a/gtk/gtkcssarrayvalue.c
+++ b/gtk/gtkcssarrayvalue.c
@@ -73,11 +73,17 @@ gtk_css_value_array_print (const GtkCssValue *value,
{
guint i;
+ if (value->n_values == 0)
+ {
+ g_string_append (string, "none");
+ return;
+ }
+
for (i = 0; i < value->n_values; i++)
{
if (i > 0)
g_string_append (string, ", ");
- _gtk_css_value_unref (value->values[i]);
+ _gtk_css_value_print (value->values[i]);
}
}
@@ -94,10 +100,9 @@ _gtk_css_array_value_new (GtkCssValue **values,
{
GtkCssValue *result;
- g_return_val_if_fail (values != NULL, NULL);
- g_return_val_if_fail (n_values > 0, NULL);
+ g_return_val_if_fail (values != NULL || n_values == 0, NULL);
- result = _gtk_css_value_alloc (>K_CSS_VALUE_ARRAY, sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (n_values - 1));
+ result = _gtk_css_value_alloc (>K_CSS_VALUE_ARRAY, sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (MAX (1, n_values) - 1));
result->n_values = n_values;
memcpy (&result->values[0], values, sizeof (GtkCssValue *) * n_values);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]