From: Timo Sirainen Date: Mon, 12 Dec 2016 03:16:28 +0000 (+0200) Subject: lib: Optimization - p_strconcat() doesn't need to allocate from data stack X-Git-Tag: 2.3.0.rc1~2411 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19b9eb5baaf89c2cccce41a71191b1e7ca9283cf;p=thirdparty%2Fdovecot%2Fcore.git lib: Optimization - p_strconcat() doesn't need to allocate from data stack Various other parts of the code already rely on p_malloc() not overwriting t_buffer_get()'ed data. p_strconcat() can do that as well. --- diff --git a/src/lib/strfuncs.c b/src/lib/strfuncs.c index 266be153c4..0fa45beeb2 100644 --- a/src/lib/strfuncs.c +++ b/src/lib/strfuncs.c @@ -217,12 +217,9 @@ char *p_strconcat(pool_t pool, const char *str1, ...) ret = vstrconcat(str1, args, &len); t_buffer_alloc(len); } else { - T_BEGIN { - temp = vstrconcat(str1, args, &len); - t_buffer_alloc(len); - ret = p_malloc(pool, len); - memcpy(ret, temp, len); - } T_END; + temp = vstrconcat(str1, args, &len); + ret = p_malloc(pool, len); + memcpy(ret, temp, len); } va_end(args);