]> 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)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 12 Jun 2017 14:05:32 +0000 (17:05 +0300)
message_address_parse() always initialized rfc822_parser_init() with
last_comment string.

src/lib-mail/message-address.c

index ccb1392a7a00ea75fd826b525d6dd7a371b19e48..0db091d90b1199175c51da62b9f22dfd5dc1479c 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;
 }