]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Portability to x86_64-linux and other platforms where va_list is an array type.
authorBruno Haible <bruno@clisp.org>
Wed, 26 Sep 2007 10:14:24 +0000 (10:14 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:15:05 +0000 (12:15 +0200)
gnulib-local/ChangeLog
gnulib-local/lib/vasprintf.c

index ca1969629e78927752c9b0079e6502abc4bfe9c7..7907d88b1ab035999597887e35a2fb37beaa4692 100644 (file)
@@ -1,3 +1,15 @@
+2007-09-26  Bruno Haible  <bruno@clisp.org>
+
+       * lib/vasprintf.c (int_vasprintf): Pass the args as a va_list,
+       not as a 'va_list *'. Needed on x86_64-linux, where va_list is an
+       array type: taking the address of a parameter of type va_list does
+       not yield a 'va_list *'. We have to assume that platforms where
+       passing a va_list by reference is useful (either because va_end is
+       not a no-op or because sizeof(va_list) is large) have already defined
+       va_list to an array type; no need to try to enforce passing by
+       reference.
+       Reported by Cristian Baboi <cristi@ot.onrc.ro>.
+
 2007-09-24  Bruno Haible  <bruno@clisp.org>
 
        * lib/vasprintf.c (int_vasprintf): Use va_copy and va_end.
index 632e88b1300dc50a517cf5b7a8fa01d89960b96e..ceac91a1090270126b8a940d98bcb2ad7da28fde 100644 (file)
@@ -32,7 +32,7 @@ size_t global_total_width;
 #endif
 
 static int
-int_vasprintf (char **result, const char *format, va_list *args)
+int_vasprintf (char **result, const char *format, va_list args)
 {
   const char *p = format;
   /* Add one to make sure that it is never zero, which might cause malloc
@@ -40,7 +40,7 @@ int_vasprintf (char **result, const char *format, va_list *args)
   size_t total_width = strlen (format) + 1;
   va_list ap;
 
-  va_copy (ap, *args);
+  va_copy (ap, args);
   while (*p != '\0')
     {
       if (*p++ == '%')
@@ -115,7 +115,7 @@ int_vasprintf (char **result, const char *format, va_list *args)
 #endif
   *result = malloc (total_width);
   if (*result != NULL)
-    return vsprintf (*result, format, *args);
+    return vsprintf (*result, format, args);
   else
     return -1;
 }
@@ -123,7 +123,7 @@ int_vasprintf (char **result, const char *format, va_list *args)
 int
 vasprintf (char **result, const char *format, va_list args)
 {
-  return int_vasprintf (result, format, &args);
+  return int_vasprintf (result, format, args);
 }
 
 int