Mercurial > hg > octave-max
diff src/cutils.c @ 4124:0435429c1050
[project @ 2002-10-24 21:49:45 by jwe]
author | jwe |
---|---|
date | Thu, 24 Oct 2002 21:49:45 +0000 |
parents | ddc722b38e87 |
children | 0d411821682c |
line wrap: on
line diff
--- a/src/cutils.c +++ b/src/cutils.c @@ -119,13 +119,19 @@ return strncasecmp (s1, s2, n); } +// We manage storage. User should not free it, and its contents are +// only valid until next call to vsnprintf. + char * octave_vsnprintf (const char *fmt, va_list args) { #if defined (HAVE_VSNPRINTF) - size_t size = 100; + static size_t size = 100; - char *buf = malloc (size); + static char *buf = 0; + + if (! buf) + buf = malloc (size); while (1) {