Mercurial > dovecot > core-2.2
changeset 21321:d80f9583a9ec
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.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 12 Dec 2016 05:16:28 +0200 |
parents | 1bdfc555f6a3 |
children | 5ab8dc1a4a6f |
files | src/lib/strfuncs.c |
diffstat | 1 files changed, 3 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/strfuncs.c Mon Dec 12 04:55:47 2016 +0200 +++ b/src/lib/strfuncs.c Mon Dec 12 05:16:28 2016 +0200 @@ -213,16 +213,9 @@ if (ret != NULL) t_buffer_alloc(len); } else { - T_BEGIN { - temp = vstrconcat(str1, args, &len); - if (temp == NULL) - ret = NULL; - else { - 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);