]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: remove useless NULL check after calling vstrconcat
authorBaofeng Wang <baofeng.wang@dovecot.fi>
Mon, 9 May 2016 11:04:47 +0000 (14:04 +0300)
committerBaofeng Wang <baofeng.wang@dovecot.fi>
Fri, 3 Jun 2016 11:32:24 +0000 (14:32 +0300)
behavior change accordingly.

src/lib/imem.c
src/lib/strfuncs.c

index 608594e46cbea6443835ac0960ca8a1aa610ae60..1f3f67cebb74059bf698f7c2b0e0768079e6b463 100644 (file)
@@ -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);
index aa293f906fbc8b8d201551f61057b89532fe864f..2139591c48bfc5e4edd6cf757a7959c7c23cc797 100644 (file)
@@ -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;