summaryrefslogtreecommitdiff
path: root/gtk/gtkcssstringvalue.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2014-05-01 19:47:58 +0200
committerBenjamin Otte <otte@redhat.com>2014-05-05 15:48:02 +0200
commitb356d814106bd33448a141423b4059e60db9b377 (patch)
tree3c5147db0a42c2a05be774e85392365364902a25 /gtk/gtkcssstringvalue.c
parentd495ab1ca01f51e7d34bc334fc343f65388f1475 (diff)
downloadgtk+-b356d814106bd33448a141423b4059e60db9b377.tar.gz
css: Split out a common function
It's used in two places already, and Iwant to use it in a third one.
Diffstat (limited to 'gtk/gtkcssstringvalue.c')
-rw-r--r--gtk/gtkcssstringvalue.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index f97b512a09..11a893af83 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -65,47 +65,13 @@ static void
gtk_css_value_string_print (const GtkCssValue *value,
GString *str)
{
- char *string = value->string;
- gsize len;
-
- if (string == NULL)
+ if (value->string == NULL)
{
g_string_append (str, "none");
return;
}
- g_string_append_c (str, '"');
-
- do {
- len = strcspn (string, "\"\n\r\f");
- g_string_append_len (str, string, len);
- string += len;
- switch (*string)
- {
- case '\0':
- break;
- case '\n':
- g_string_append (str, "\\A ");
- break;
- case '\r':
- g_string_append (str, "\\D ");
- break;
- case '\f':
- g_string_append (str, "\\C ");
- break;
- case '\"':
- g_string_append (str, "\\\"");
- break;
- case '\\':
- g_string_append (str, "\\\\");
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- } while (*string);
-
- g_string_append_c (str, '"');
+ _gtk_css_print_string (str, value->string);
}
static void