author | Francesco Abbate <francesco.bbt@gmail.com> | 2011年12月20日 16:34:34 +0100 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2011年12月20日 16:34:34 +0100 |
commit | b61f1de6a37befa7f8cfd93c2cb21bb54a31637f (patch) | |
tree | 3376f91411505c946fb915846fb657dacf0d38e1 | |
parent | 10e0c81563681a0b5db86796d3fdbbf5925ff1cd (diff) | |
download | gsl-shell-b61f1de6a37befa7f8cfd93c2cb21bb54a31637f.tar.gz |
-rw-r--r-- | str.c | 7 |
@@ -263,6 +263,9 @@ str_vprintf (str_t d, const char *fmt, int append, va_list ap) char *xbuf;
int xbuf_size;
int ns;
+ va_list aq;
+
+ va_copy (aq, ap);
ns = vsnprintf (buffer, STR_BUFSIZE, fmt, ap);
@@ -270,7 +273,7 @@ str_vprintf (str_t d, const char *fmt, int append, va_list ap) {
xbuf_size = ns+1;
xbuf = malloc (xbuf_size);
- vsnprintf (xbuf, xbuf_size, fmt, ap);
+ vsnprintf (xbuf, xbuf_size, fmt, aq);
}
else
{
@@ -278,6 +281,8 @@ str_vprintf (str_t d, const char *fmt, int append, va_list ap) xbuf_size = 0;
}
+ va_end (aq);
+
if (append)
{
str_append_c (d, xbuf, 0);
|