From: Bruno Haible Date: Wed, 26 Sep 2007 10:14:24 +0000 (+0000) Subject: Portability to x86_64-linux and other platforms where va_list is an array type. X-Git-Tag: v0.17~244 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af2ab3aafbf83fe88047fe98b021317108524db0;p=thirdparty%2Fgettext.git Portability to x86_64-linux and other platforms where va_list is an array type. --- diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog index ca1969629..7907d88b1 100644 --- a/gnulib-local/ChangeLog +++ b/gnulib-local/ChangeLog @@ -1,3 +1,15 @@ +2007-09-26 Bruno Haible + + * 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 . + 2007-09-24 Bruno Haible * lib/vasprintf.c (int_vasprintf): Use va_copy and va_end. diff --git a/gnulib-local/lib/vasprintf.c b/gnulib-local/lib/vasprintf.c index 632e88b13..ceac91a10 100644 --- a/gnulib-local/lib/vasprintf.c +++ b/gnulib-local/lib/vasprintf.c @@ -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