*/
-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
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')
{
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;
}
va_list args;
#endif
{
- return int_vasprintf (result, format, &args);
+ return int_vasprintf (result, format, args);
}
#ifdef TEST