aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2003-10-30 21:31:43 +0000
committerDJ Delorie <dj@redhat.com>2003-10-30 21:31:43 +0000
commit2382c03f5ad9ff28087ef73c79b1e1d64c9e9e04 (patch)
treea71b8e0ff29c5ba5e926d0ebd87cc3790bbc9529 /libiberty
parentbb489b3c99cfe1484a3bbd37acdaee5f2cf96b98 (diff)
downloadgdb-2382c03f5ad9ff28087ef73c79b1e1d64c9e9e04.zip
gdb-2382c03f5ad9ff28087ef73c79b1e1d64c9e9e04.tar.gz
gdb-2382c03f5ad9ff28087ef73c79b1e1d64c9e9e04.tar.bz2
merge from gcc
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/vasprintf.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c
index 7752604..d3d4f3a 100644
--- a/libiberty/vasprintf.c
+++ b/libiberty/vasprintf.c
@@ -59,13 +59,13 @@ not be allocated, minus one is returned and @code{NULL} is stored in
*/
-static int int_vasprintf PARAMS ((char **, const char *, va_list *));
+static int int_vasprintf PARAMS ((char **, const char *, va_list));
static int
int_vasprintf (result, format, args)
char **result;
const char *format;
- va_list *args;
+ va_list args;
{
const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc
@@ -73,7 +73,11 @@ int_vasprintf (result, format, args)
int total_width = strlen (format) + 1;
va_list ap;
- memcpy ((PTR) &ap, (PTR) args, sizeof (va_list));
+#ifdef va_copy
+ va_copy (ap, args);
+#else
+ memcpy ((PTR) &ap, (PTR) &args, sizeof (va_list));
+#endif
while (*p != '\0')
{
@@ -135,12 +139,15 @@ int_vasprintf (result, format, args)
p++;
}
}
+#ifdef va_copy
+ va_end (ap);
+#endif
#ifdef TEST
global_total_width = total_width;
#endif
*result = (char *) malloc (total_width);
if (*result != NULL)
- return vsprintf (*result, format, *args);
+ return vsprintf (*result, format, args);
else
return -1;
}
@@ -155,7 +162,7 @@ vasprintf (result, format, args)
va_list args;
#endif
{
- return int_vasprintf (result, format, &args);
+ return int_vasprintf (result, format, args);
}
#ifdef TEST