[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettext-0.16.1: file vasprintf.c is wrong on amd64 bit
From: |
Bruno Haible |
Subject: |
Re: gettext-0.16.1: file vasprintf.c is wrong on amd64 bit |
Date: |
Tue, 25 Sep 2007 01:04:26 +0200 |
User-agent: |
KMail/1.5.4 |
Hello,
Cristian Baboi wrote:
> #!./bin/sh
> echo "">config.h
> gcc -m64 -D TEST -I .
> ./a.out
>
> The code does not compile.
> See attachment.
Thank you for reporting this. Indeed, a call to va_copy is missing here,
since a va_list can only be traversed once, not twice. I have applied the
appended patch. But I don't understand the need for va_copy in the second
part of your patch. Why should that be needed?
2007-09-24 Bruno Haible <address@hidden>
* lib/vasprintf.c (int_vasprintf): Use va_copy.
* modules/vasprintf.diff: Add dependency to stdarg.
Reported by Cristian Baboi <address@hidden>.
*** lib/vasprintf.c 13 May 2007 23:06:17 -0000 1.3
--- lib/vasprintf.c 24 Sep 2007 23:02:46 -0000
***************
*** 38,45 ****
/* Add one to make sure that it is never zero, which might cause malloc
to return NULL. */
size_t total_width = strlen (format) + 1;
! va_list ap = *args;
while (*p != '\0')
{
if (*p++ == '%')
--- 38,46 ----
/* Add one to make sure that it is never zero, which might cause malloc
to return NULL. */
size_t total_width = strlen (format) + 1;
! va_list ap;
+ va_copy (ap, *args);
while (*p != '\0')
{
if (*p++ == '%')