From 7da0d129c53e11c56f7401e5dcf50581639274d9 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 1 Apr 2021 12:33:33 +0300 Subject: [PATCH] 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. --- src/lib-imap/imap-envelope.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; } -- 2.47.3