Index: docs/reference/glib/glib-sections.txt
===================================================================
--- docs/reference/glib/glib-sections.txt	(revision 5558)
+++ docs/reference/glib/glib-sections.txt	(working copy)
@@ -2018,6 +2018,8 @@
 g_string_assign
 g_string_sprintf
 g_string_sprintfa
+g_string_vprintf
+g_string_append_vprintf
 g_string_printf
 g_string_append_printf
 g_string_append
Index: glib/glib.symbols
===================================================================
--- glib/glib.symbols	(revision 5558)
+++ glib/glib.symbols	(working copy)
@@ -1124,6 +1124,7 @@
 g_string_append_len
 g_string_append_printf G_GNUC_PRINTF(2,3)
 g_string_append_unichar
+g_string_append_vprintf
 g_string_ascii_down
 g_string_ascii_up
 g_string_assign
@@ -1155,6 +1156,7 @@
 g_string_down
 g_string_up
 #endif
+g_string_vprintf
 #ifdef INCLUDE_INTERNAL_SYMBOLS
  /* these are not internal, but we don't want to alias them */
 g_string_append_c
Index: glib/gstring.c
===================================================================
--- glib/gstring.c	(revision 5558)
+++ glib/gstring.c	(working copy)
@@ -1190,20 +1190,55 @@
   return string;
 }
 
-static void
-g_string_append_printf_internal (GString     *string,
-				 const gchar *fmt,
-				 va_list      args)
+/**
+ * g_string_append_vprintf:
+ * @string: a #GString.
+ * @format: the string format. See the printf() documentation.
+ * @args: the list of arguments to insert in the output.
+ *
+ * Appends a formatted string onto the end of a #GString.
+ * This function is is similar to g_string_append_printf()
+ * except that the arguments to the format string are passed
+ * as a va_list.
+ *
+ * Since: 2.14
+ */
+void
+g_string_append_vprintf (GString     *string,
+			 const gchar *fmt,
+			 va_list      args)
 {
-  gchar *buffer;
   gint length;
-  
-  length = g_vasprintf (&buffer, fmt, args);
-  g_string_append_len (string, buffer, length);
-  g_free (buffer);
+
+  length = g_printf_string_upper_bound (fmt, args);
+  g_string_maybe_expand (string, length);
+  length = g_vsnprintf (string->str + string->len, length, fmt, args);
+  string->len += length;
 }
 
 /**
+ * g_string_vprintf:
+ * @string: a #GString.
+ * @format: the string format. See the printf() documentation.
+ * @Varargs: the parameters to insert into the format string.
+ *
+ * Writes a formatted string into a #GString.  This function
+ * is similar to g_string_printf() except that the arguments to
+ * the format string are passed as a va_list.
+ *
+ * Since: 2.14
+ */
+void
+g_string_vprintf (GString     *string,
+		  const gchar *fmt,
+		  va_list      args)
+{
+  g_string_truncate (string, 0);
+
+  g_string_append_vprintf (string, fmt, args);
+}
+
+/**
  * g_string_sprintf:
  * @string: a #GString.
  * @format: the string format. See the sprintf() documentation.
@@ -1240,7 +1275,7 @@
   g_string_truncate (string, 0);
 
   va_start (args, fmt);
-  g_string_append_printf_internal (string, fmt, args);
+  g_string_append_vprintf (string, fmt, args);
   va_end (args);
 }
 
@@ -1276,7 +1311,7 @@
   va_list args;
 
   va_start (args, fmt);
-  g_string_append_printf_internal (string, fmt, args);
+  g_string_append_vprintf (string, fmt, args);
   va_end (args);
 }
 
Index: glib/gstring.h
===================================================================
--- glib/gstring.h	(revision 5558)
+++ glib/gstring.h	(working copy)
@@ -110,9 +110,15 @@
 					 gssize		  len);
 GString*     g_string_ascii_down        (GString	 *string);
 GString*     g_string_ascii_up          (GString	 *string);
+void         g_string_vprintf           (GString	 *string,
+					 const gchar	 *format,
+					 va_list          args);
 void         g_string_printf            (GString	 *string,
 					 const gchar	 *format,
 					 ...) G_GNUC_PRINTF (2, 3);
+void         g_string_append_vprintf    (GString	 *string,
+					 const gchar	 *format,
+					 va_list          args);
 void         g_string_append_printf     (GString	 *string,
 					 const gchar	 *format,
 					 ...) G_GNUC_PRINTF (2, 3);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 5558)
+++ ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2007-06-14  Ryan Lortie  <desrt@desrt.ca>
+
+	* docs/reference/glib/glib-sections.txt:
+	* glib/glib/symbols:
+	* glib/gstring.[ch] (g_string_printf_internal): Improve
+	performance by removing the use of an intermediate g_malloc'd
+	buffer.  Rename to g_string_append_vprintf, document, and expose
+	along with g_string_vprintf as new public API.
+
 2007-06-14  Matthias Clasen  <mclasen@redhat.com>
 	
 	* glib/gmain.c (g_timeout_add_seconds): Fix doc typos.  (#447534,
