Skip to content

Commit

Permalink
lib-mail: message_address_parse() - Remove unnecessary NULL checks
Browse files Browse the repository at this point in the history
message_address_parse() always initialized rfc822_parser_init() with
last_comment string.
  • Loading branch information
sirainen committed Jun 12, 2017
1 parent 7b7f965 commit a646e69
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/lib-mail/message-address.c
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down

0 comments on commit a646e69

Please sign in to comment.