]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: message_address_parse() - Remove unnecessary NULL checks
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 7 Jun 2017 10:34:39 +0000 (13:34 +0300)
committerGitLab <gitlab@git.dovecot.net>
Wed, 7 Jun 2017 15:33:55 +0000 (18:33 +0300)
message_address_parse() always initialized rfc822_parser_init() with
last_comment string.

src/lib-mail/message-address.c

index c5239823eddd0429bd8cb386be932625c094625d..d10cd473c64c3190d74f1140aeb1c31fadcf32ad 100644 (file)
@@ -204,8 +204,7 @@ static int parse_addr_spec(struct message_address_parser_context *ctx)
        /* addr-spec       = local-part "@" domain */
        int ret, ret2;
 
-       if (ctx->parser.last_comment != NULL)
-               str_truncate(ctx->parser.last_comment, 0);
+       str_truncate(ctx->parser.last_comment, 0);
 
        ret = parse_local_part(ctx);
        if (ret <= 0) {
@@ -218,12 +217,8 @@ static int parse_addr_spec(struct message_address_parser_context *ctx)
                        ret = ret2;
        }
 
-       if (ctx->parser.last_comment != NULL) {
-               if (str_len(ctx->parser.last_comment) > 0) {
-                       ctx->addr.name =
-                               p_strdup(ctx->pool, str_c(ctx->parser.last_comment));
-               }
-       }
+       if (str_len(ctx->parser.last_comment) > 0)
+               ctx->addr.name = p_strdup(ctx->pool, str_c(ctx->parser.last_comment));
        return ret;
 }