From 438e95b110ed8e3ec011081f586cf1a443388caa Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 18 Apr 2009 12:50:32 +0400 Subject: [PATCH] src/strutil.c (str_printf): use g_string_append_vprintf() function if available. --- src/strutil.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/strutil.c b/src/strutil.c index 2bfb17454..de29ca09a 100644 --- a/src/strutil.c +++ b/src/strutil.c @@ -252,17 +252,18 @@ str_vfs_convert_to (GIConv coder, const char *string, int size, void str_printf (GString * buffer, const char *format, ...) { - gchar *tmp; va_list ap; va_start (ap, format); - /* - * more simple call: - g_string_append_vprintf (buffer, format, ap); - * but not all versions of glib2 have this function :( - */ - tmp = g_strdup_vprintf ( format, ap); - g_string_append (buffer, tmp); - g_free(tmp); +#if GLIB_CHECK_VERSION (2, 14, 0) + g_string_append_vprintf (buffer, format, ap); +#else + { + gchar *tmp; + tmp = g_strdup_vprintf (format, ap); + g_string_append (buffer, tmp); + g_free(tmp); + } +#endif va_end (ap); }