From: Baofeng Wang Date: Mon, 9 May 2016 11:04:47 +0000 (+0300) Subject: lib: remove useless NULL check after calling vstrconcat X-Git-Tag: 2.3.0.rc1~3580 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74835112bd3e43451cfc8cafc7fcbcb0660b2da0;p=thirdparty%2Fdovecot%2Fcore.git lib: remove useless NULL check after calling vstrconcat behavior change accordingly. --- diff --git a/src/lib/imem.c b/src/lib/imem.c index 608594e46c..1f3f67cebb 100644 --- a/src/lib/imem.c +++ b/src/lib/imem.c @@ -63,14 +63,9 @@ char *i_strconcat(const char *str1, ...) T_BEGIN { const char *temp = vstrconcat(str1, args, &len); - - if (temp == NULL) - ret = NULL; - else { - t_buffer_alloc(len); - ret = p_malloc(default_pool, len); - memcpy(ret, temp, len); - } + t_buffer_alloc(len); + ret = p_malloc(default_pool, len); + memcpy(ret, temp, len); } T_END; va_end(args); diff --git a/src/lib/strfuncs.c b/src/lib/strfuncs.c index aa293f906f..2139591c48 100644 --- a/src/lib/strfuncs.c +++ b/src/lib/strfuncs.c @@ -214,18 +214,13 @@ char *p_strconcat(pool_t pool, const char *str1, ...) if (pool->datastack_pool) { ret = vstrconcat(str1, args, &len); - if (ret != NULL) - t_buffer_alloc(len); + 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_buffer_alloc(len); + ret = p_malloc(pool, len); + memcpy(ret, temp, len); } T_END; } @@ -287,8 +282,7 @@ const char *t_strconcat(const char *str1, ...) va_start(args, str1); ret = vstrconcat(str1, args, &len); - if (ret != NULL) - t_buffer_alloc(len); + t_buffer_alloc(len); va_end(args); return ret;