]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: index_mail_get_cached_bodystructure() - Reorder the if statements
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 10 Sep 2020 13:36:14 +0000 (16:36 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 7 Oct 2020 11:43:37 +0000 (11:43 +0000)
Simplifies the following commit.

src/lib-storage/index/index-mail.c

index 276c54e69d3493a58332623dee3155ef4a508127..4d2398ad00d9be664f8bc335eeefda7883014055 100644 (file)
@@ -1548,18 +1548,16 @@ bool index_mail_get_cached_bodystructure(struct index_mail *mail,
 
        str = str_new(mail->mail.data_pool, 128);
        if ((data->cache_flags & MAIL_CACHE_FLAG_TEXT_PLAIN_7BIT_ASCII) != 0 &&
-           get_cached_parts(mail)) {
+           get_cached_parts(mail))
                index_mail_get_plain_bodystructure(mail, str, TRUE);
-               *value_r = data->bodystructure = str_c(str);
-               return TRUE;
-       }
-       if (index_mail_cache_lookup_field(mail, str, bodystructure_cache_field) > 0) {
-               *value_r = data->bodystructure = str_c(str);
-               return TRUE;
+       else if (index_mail_cache_lookup_field(mail, str,
+                       bodystructure_cache_field) <= 0) {
+               str_free(&str);
+               return FALSE;
        }
 
-       str_free(&str);
-       return FALSE;
+       *value_r = data->bodystructure = str_c(str);
+       return TRUE;
 }
 
 int index_mail_get_special(struct mail *_mail,