changeset 236:400ac5f9ed40 HEAD

previous t_push()/t_pop() changes break things. fixed :)
author Timo Sirainen <tss@iki.fi>
date Mon, 16 Sep 2002 06:33:06 +0300
parents 1fe8eae6fd89
children 06d6eca0a45f
files src/lib/strfuncs.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/strfuncs.c	Mon Sep 16 06:13:10 2002 +0300
+++ b/src/lib/strfuncs.c	Mon Sep 16 06:33:06 2002 +0300
@@ -470,11 +470,11 @@
 	i_assert(format != NULL);
 
 	t_push();
+
 	va_start(args, format);
 	format = fix_format(format);
 	buf = t_buffer_get(printf_string_upper_bound(format, args));
 	va_end(args);
-	t_pop();
 
 	len = vsprintf(buf, format, args);
 	if (len >= (int)max_chars)
@@ -482,6 +482,8 @@
 
         memcpy(str, buf, len);
 	str[len] = '\0';
+
+	t_pop();
 	return len;
 #endif
 }
@@ -652,7 +654,6 @@
 	if (format == NULL)
 		return NULL;
 
-	t_push();
 	format = fix_format(format);
 
 	VA_COPY(temp_args, args);
@@ -661,14 +662,18 @@
 	vsprintf(ret, format, args);
 
 	va_end(temp_args);
-	t_pop();
 
         return ret;
 }
 
 char *p_strdup_vprintf(Pool pool, const char *format, va_list args)
 {
-        return strdup_vprintf_core(format, args, pool->malloc, pool);
+	char *ret;
+
+	t_push();
+	ret = strdup_vprintf_core(format, args, pool->malloc, pool);
+	t_pop();
+	return ret;
 }
 
 const char *t_strdup_vprintf(const char *format, va_list args)