From 6d2b92125afcd78112448cc5174de5af3e0eb45b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 15 Nov 2011 13:47:05 +0900 Subject: [PATCH] Make nva a little more memory efficient. --- libs/util/va.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/util/va.c b/libs/util/va.c index 7da7a775f..361b7a092 100644 --- a/libs/util/va.c +++ b/libs/util/va.c @@ -70,14 +70,13 @@ VISIBLE char * nva (const char *fmt, ...) { va_list args; - static dstring_t *string; + dstring_t *string; - if (!string) - string = dstring_new (); + string = dstring_new (); va_start (args, fmt); dvsprintf (string, fmt, args); va_end (args); - return strdup (string->str); + return dstring_freeze (string); }