]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Move index_mail.search_mail to mail_private struct
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 28 Feb 2019 13:08:38 +0000 (15:08 +0200)
committerMartti Rannanjärvi <martti.rannanjarvi@open-xchange.com>
Wed, 25 Sep 2019 08:25:20 +0000 (11:25 +0300)
src/lib-storage/index/imapc/imapc-mail.c
src/lib-storage/index/index-mail.c
src/lib-storage/index/index-mail.h
src/lib-storage/index/index-search.c
src/lib-storage/mail-storage-private.h
src/lib-storage/mail.c

index 4c730dd97a40b2d5741b0586e24da089a0fe49e9..9cc0ea27603b39f2a8665fa9ec0d8b1cc2ba1f88 100644 (file)
@@ -419,7 +419,7 @@ static void imapc_mail_set_seq(struct mail *_mail, uint32_t seq, bool saving)
 
        /* searching code handles prefetching internally,
           elsewhere we want to do it immediately */
-       if (!mail->search_mail && !_mail->saving)
+       if (!mail->mail.search_mail && !_mail->saving)
                (void)imapc_mail_prefetch(_mail);
 }
 
index 416f3685f3d09363436c62e0a251564c5a9df69e..53dfdef83638d1ec1a8f19a4bae556736a2fb7d9 100644 (file)
@@ -2008,7 +2008,7 @@ void index_mail_set_seq(struct mail *_mail, uint32_t seq, bool saving)
                return;
        }
 
-       if (!mail->search_mail) {
+       if (!mail->mail.search_mail) {
                index_mail_update_access_parts_pre(_mail);
                index_mail_update_access_parts_post(_mail);
        } else {
@@ -2122,10 +2122,6 @@ void index_mail_free(struct mail *_mail)
 {
        struct index_mail *mail = INDEX_MAIL(_mail);
 
-       /* make sure mailbox_search_*() users don't try to free the mail
-          directly */
-       i_assert(!mail->search_mail);
-
        mail->freeing = TRUE;
        mail->mail.v.close(_mail);
 
index 62d7ceeaca0b2270dbc429a579c96ba72ab777f9..58a585203fd7f01d3ed73ba235700bbf527bbc08 100644 (file)
@@ -155,8 +155,6 @@ struct index_mail {
        uint8_t header_match_value;
 
        bool pop3_state_set:1;
-       /* mail created by mailbox_search_*() */
-       bool search_mail:1;
        /* close() is being called from mail_free() */
        bool freeing:1;
 };
index 6d248fb2e7b4a20bad7597e854b7bd6564d37fa5..e0689a46ffede51843ac8377a8e01c2181dfb425 100644 (file)
@@ -1367,7 +1367,7 @@ int index_storage_search_deinit(struct mail_search_context *_ctx)
        array_foreach_modifiable(&ctx->mails, mailp) {
                struct index_mail *imail = INDEX_MAIL(*mailp);
 
-               imail->search_mail = FALSE;
+               imail->mail.search_mail = FALSE;
                mail_free(mailp);
        }
 
@@ -1686,7 +1686,7 @@ struct mail *index_search_get_mail(struct index_search_context *ctx)
                          ctx->mail_ctx.wanted_fields,
                          ctx->mail_ctx.wanted_headers);
        imail = INDEX_MAIL(mail);
-       imail->search_mail = TRUE;
+       imail->mail.search_mail = TRUE;
        ctx->mail_ctx.transaction->stats_track = TRUE;
 
        array_push_back(&ctx->mails, &mail);
index 5e9896b1189e812bceb2e926a6777a53ff352348..2647c5a0bf4a44c568b765ab0e9f595f229493a4 100644 (file)
@@ -558,6 +558,8 @@ struct mail_private {
        const char *get_stream_reason;
 
        bool autoexpunged:1;
+       /* mail created by mailbox_search_*() */
+       bool search_mail:1;
 };
 
 struct mailbox_list_context {
index 1bb2390487dc3ac0bb9fff5ce114faabf2afa116..aab7c4e77c7c72a31b39608bb58b514bc94bb6ba 100644 (file)
@@ -36,6 +36,10 @@ void mail_free(struct mail **mail)
 {
        struct mail_private *p = (struct mail_private *)*mail;
 
+       /* make sure mailbox_search_*() users don't try to free the mail
+          directly */
+       i_assert(!p->search_mail);
+
        p->v.free(*mail);
        *mail = NULL;
 }