bug fix, need va_copy() when reusing a va_list
This commit is contained in:
parent
a9bdfe3b00
commit
03f0ef778f
|
|
@ -304,4 +304,9 @@ void soa_printf(CKTcircuit *ckt, GENinstance *instance, const char *fmt, ...);
|
|||
#define NG_IGNOREABLE(x) (void)x
|
||||
|
||||
|
||||
#if !defined(va_copy) && defined(_MSC_VER)
|
||||
#define va_copy(dst, src) ((dst) = (src))
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -939,7 +939,11 @@ sh_vfprintf(FILE *f, const char *fmt, va_list args)
|
|||
// assert(size > 0);
|
||||
|
||||
for (;;) {
|
||||
nchars = vsnprintf(p, size, fmt, args);
|
||||
va_list ap;
|
||||
|
||||
va_copy(ap, args);
|
||||
nchars = vsnprintf(p, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(nchars == -1) { // compatibility to old implementations
|
||||
size *= 2;
|
||||
|
|
|
|||
|
|
@ -2669,7 +2669,11 @@ tcl_vfprintf(FILE *f, const char *fmt, va_list args)
|
|||
// assert(size > 0);
|
||||
|
||||
for (;;) {
|
||||
nchars = vsnprintf(p + prolog_len, size, fmt, args);
|
||||
va_list ap;
|
||||
|
||||
va_copy(ap, args);
|
||||
nchars = vsnprintf(p + prolog_len, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(nchars == -1) { /* compatibility to old implementations */
|
||||
size *= 2;
|
||||
|
|
|
|||
Loading…
Reference in New Issue