summaryrefslogtreecommitdiff
path: root/gstrfuncs.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@src.gnome.org>1999-01-09 19:14:16 +0000
committerJeff Garzik <jgarzik@src.gnome.org>1999-01-09 19:14:16 +0000
commit2a6789be13c4def678ae612d6cdf236d347374eb (patch)
tree144e050d51c6e66a8461e51ac212982ae1ef84ba /gstrfuncs.c
parentdc602866312bff134f4d827190f5c24934970e19 (diff)
downloadglib-2a6789be13c4def678ae612d6cdf236d347374eb.tar.gz
Add checks for vasprintf, localtime_r.
* configure.in: Add checks for vasprintf, localtime_r. * gdate.c (g_date_set_time): Use localtime if localtime_r is not available. * gstrfuncs.c (g_strdup_vprintf): Use glibc vasprintf if possible; it's a bit faster than using GLib routines, and makes output code a bit smaller. * acconfig.h: Remove HAVE_VSNPRINTF and HAVE_VPRINTF. autoheader picks these up automatically and puts them in config.h.in.
Diffstat (limited to 'gstrfuncs.c')
-rw-r--r--gstrfuncs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gstrfuncs.c b/gstrfuncs.c
index e154c56dc..6e58ad5e0 100644
--- a/gstrfuncs.c
+++ b/gstrfuncs.c
@@ -108,6 +108,15 @@ g_strdup_vprintf (const gchar *format,
va_list args1)
{
gchar *buffer;
+
+#if (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK)
+ /* if memory checking is disabled, that means we can call g_free() on
+ * memory obtained via malloc(). This allows us to use the
+ * glibc vasprintf() call where available.
+ */
+ vasprintf (&buffer, format, args1);
+#else
+
va_list args2;
G_VA_COPY (args2, args1);
@@ -117,6 +126,8 @@ g_strdup_vprintf (const gchar *format,
vsprintf (buffer, format, args2);
va_end (args2);
+#endif /* (HAVE_VASPRINTF) && !(ENABLE_MEM_CHECK) */
+
return buffer;
}