--- uuid_str.c 2006/01/13 06:44:31 1.6
+++ uuid_str.c 2006/03/13 09:39:11 1.7
@@ -690,10 +690,13 @@
{
char *rv;
int n;
+ va_list ap_bak;
+ va_copy(ap_bak, ap);
n = str_vsnprintf(NULL, 0, fmt, ap);
if ((rv = (char *)malloc(n+1)) == NULL)
return NULL;
+ va_copy(ap, ap_bak);
str_vsnprintf(rv, n+1, fmt, ap);
return rv;
}
@@ -720,6 +723,7 @@
{
int rv;
size_t n;
+ va_list ap_bak;
if (str == NULL)
return -1;
@@ -728,10 +732,12 @@
rv = strlen(*str);
}
else {
+ va_copy(ap_bak, ap);
n = strlen(*str);
rv = str_vsnprintf(NULL, 0, fmt, ap);
if ((*str = (char *)realloc(*str, n+rv+1)) == NULL)
return -1;
+ va_copy(ap, ap_bak);
str_vsnprintf((*str)+n, rv+1, fmt, ap);
}
return rv;
|