From: Timo Sirainen Date: Thu, 1 Apr 2021 09:33:33 +0000 (+0300) Subject: lib-imap: imap_envelope_parse() - Refactor to avoid LTO warnings X-Git-Tag: 2.3.15~99 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7da0d129c53e11c56f7401e5dcf50581639274d9;p=thirdparty%2Fdovecot%2Fcore.git lib-imap: imap_envelope_parse() - Refactor to avoid LTO warnings The original code was correct, but gcc with LTO still gave warnings about potentially uninitialized envlp_r and error_r. --- diff --git a/src/lib-imap/imap-envelope.c b/src/lib-imap/imap-envelope.c index d107d66665..87297f4f69 100644 --- a/src/lib-imap/imap-envelope.c +++ b/src/lib-imap/imap-envelope.c @@ -223,6 +223,7 @@ bool imap_envelope_parse(const char *envelope, struct imap_parser *parser; const struct imap_arg *args; int ret; + bool success; input = i_stream_create_from_data(envelope, strlen(envelope)); (void)i_stream_read(input); @@ -233,15 +234,15 @@ bool imap_envelope_parse(const char *envelope, if (ret < 0) { *error_r = t_strdup_printf("IMAP parser failed: %s", imap_parser_get_error(parser, NULL)); + success = FALSE; } else if (ret == 0) { *error_r = "Empty envelope"; - ret = -1; + success = FALSE; } else { - if (!imap_envelope_parse_args(args, pool, envlp_r, error_r)) - ret = -1; + success = imap_envelope_parse_args(args, pool, envlp_r, error_r); } imap_parser_unref(&parser); i_stream_destroy(&input); - return (ret >= 0); + return success; }