[gtk+/nth-child: 20/22] styleproperty: Add a helper function for printing doubles
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/nth-child: 20/22] styleproperty: Add a helper function for printing doubles
- Date: Thu, 26 May 2011 03:32:15 +0000 (UTC)
commit d22a178aca5885bcdfbf83aa7f0fb0af4ce2d37d
Author: Benjamin Otte <otte redhat com>
Date: Thu May 26 03:44:09 2011 +0200
styleproperty: Add a helper function for printing doubles
We will want to print doubles more often, so add a little helper
function for it. We cannot use printf() here, because we want English
locale output.
gtk/gtkstyleproperty.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index a79a264..bcd7e32 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -312,15 +312,22 @@ double_value_parse (GtkCssParser *parser,
}
static void
-double_value_print (const GValue *value,
- GString *string)
+string_append_double (GString *string,
+ double d)
{
char buf[G_ASCII_DTOSTR_BUF_SIZE];
- g_ascii_dtostr (buf, sizeof (buf), g_value_get_double (value));
+ g_ascii_dtostr (buf, sizeof (buf), d);
g_string_append (string, buf);
}
+static void
+double_value_print (const GValue *value,
+ GString *string)
+{
+ string_append_double (string, g_value_get_double (value));
+}
+
static gboolean
float_value_parse (GtkCssParser *parser,
GFile *base,
@@ -342,10 +349,7 @@ static void
float_value_print (const GValue *value,
GString *string)
{
- char buf[G_ASCII_DTOSTR_BUF_SIZE];
-
- g_ascii_dtostr (buf, sizeof (buf), g_value_get_float (value));
- g_string_append (string, buf);
+ string_append_double (string, g_value_get_float (value));
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]