]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mailbox_header_lookup*() private API changed.
authorTimo Sirainen <tss@iki.fi>
Thu, 4 Jun 2009 23:30:46 +0000 (19:30 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 4 Jun 2009 23:30:46 +0000 (19:30 -0400)
--HG--
branch : HEAD

src/lib-storage/index/cydir/cydir-storage.c
src/lib-storage/index/dbox/dbox-storage.c
src/lib-storage/index/index-mail-headers.c
src/lib-storage/index/index-storage.h
src/lib-storage/index/maildir/maildir-storage.c
src/lib-storage/index/mbox/mbox-storage.c
src/lib-storage/index/raw/raw-storage.c
src/lib-storage/mail-storage-private.h
src/lib-storage/mail-storage.c
src/plugins/virtual/virtual-storage.c

index 76129f6452a6607681c354d31beac4e25c778c22..36adc08a075cf29ed5fe773a9b1dda553c889e1c 100644 (file)
@@ -395,8 +395,7 @@ struct mailbox cydir_mailbox = {
                NULL,
                index_mail_alloc,
                index_header_lookup_init,
-               index_header_lookup_ref,
-               index_header_lookup_unref,
+               index_header_lookup_deinit,
                index_storage_search_init,
                index_storage_search_deinit,
                index_storage_search_next_nonblock,
index 4a753c9b66050e35805a0980bf8dcab09ed42c86..b042495c109225deb55477bc8b848e4676f33c57 100644 (file)
@@ -796,8 +796,7 @@ struct mailbox dbox_mailbox = {
                NULL,
                dbox_mail_alloc,
                index_header_lookup_init,
-               index_header_lookup_ref,
-               index_header_lookup_unref,
+               index_header_lookup_deinit,
                index_storage_search_init,
                index_storage_search_deinit,
                index_storage_search_next_nonblock,
index bdbdd44396a4cc8c6fc25f9cba4f27d8247ac656..b9f13768f72f95c41c153980767b876166c18686 100644 (file)
@@ -885,6 +885,7 @@ index_header_lookup_init_real(struct mailbox *box, const char *const headers[])
        pool = pool_alloconly_create("index_header_lookup_ctx", 1024);
        ctx = p_new(pool, struct index_header_lookup_ctx, 1);
        ctx->ctx.box = box;
+       ctx->ctx.refcount = 1;
        ctx->pool = pool;
        ctx->count = count;
 
@@ -911,15 +912,7 @@ index_header_lookup_init(struct mailbox *box, const char *const headers[])
        return ctx;
 }
 
-void index_header_lookup_ref(struct mailbox_header_lookup_ctx *_ctx)
-{
-       struct index_header_lookup_ctx *ctx =
-               (struct index_header_lookup_ctx *)_ctx;
-
-       pool_ref(ctx->pool);
-}
-
-void index_header_lookup_unref(struct mailbox_header_lookup_ctx *_ctx)
+void index_header_lookup_deinit(struct mailbox_header_lookup_ctx *_ctx)
 {
        struct index_header_lookup_ctx *ctx =
                (struct index_header_lookup_ctx *)_ctx;
index 3e19b803a27fecce8aa10a99f9daf1ffc6470633..4d88d788b17555100c69f9546954f96eb177de42 100644 (file)
@@ -150,8 +150,7 @@ bool index_storage_get_expunged_uids(struct mailbox *box, uint64_t modseq,
 
 struct mailbox_header_lookup_ctx *
 index_header_lookup_init(struct mailbox *box, const char *const headers[]);
-void index_header_lookup_ref(struct mailbox_header_lookup_ctx *ctx);
-void index_header_lookup_unref(struct mailbox_header_lookup_ctx *ctx);
+void index_header_lookup_deinit(struct mailbox_header_lookup_ctx *ctx);
 
 struct mail_search_context *
 index_storage_search_init(struct mailbox_transaction_context *t,
index 574ad31b2b019008d1b95f0894436c9d125f0c6f..3eb5d7657b4217d45d77f409a320f686b9d5ab6c 100644 (file)
@@ -1079,8 +1079,7 @@ struct mailbox maildir_mailbox = {
                NULL,
                index_mail_alloc,
                index_header_lookup_init,
-               index_header_lookup_ref,
-               index_header_lookup_unref,
+               index_header_lookup_deinit,
                index_storage_search_init,
                index_storage_search_deinit,
                index_storage_search_next_nonblock,
index 2e3b5e4815c7ddc8f6a5d81c4047591421ce9f27..ea59c7d197e6cb73054778f62d9e5a2f6f0a0bd3 100644 (file)
@@ -912,8 +912,7 @@ struct mailbox mbox_mailbox = {
                NULL,
                index_mail_alloc,
                index_header_lookup_init,
-               index_header_lookup_ref,
-               index_header_lookup_unref,
+               index_header_lookup_deinit,
                index_storage_search_init,
                index_storage_search_deinit,
                index_storage_search_next_nonblock,
index 9b088ba571b6d183618ed4e8b2638dbf7d26d9f2..d1964954ec738537d32a3f5c9288dedb8bf843a5 100644 (file)
@@ -246,8 +246,7 @@ struct mailbox raw_mailbox = {
                NULL,
                index_mail_alloc,
                index_header_lookup_init,
-               index_header_lookup_ref,
-               index_header_lookup_unref,
+               index_header_lookup_deinit,
                index_storage_search_init,
                index_storage_search_deinit,
                index_storage_search_next_nonblock,
index 5320e4480c0b85683e06a49f6d5b059a65d1d719..58822905b067a3ad8cb789ae2fd4a6b1ff54bb3b 100644 (file)
@@ -180,8 +180,7 @@ struct mailbox_vfuncs {
        struct mailbox_header_lookup_ctx *
                (*header_lookup_init)(struct mailbox *box,
                                      const char *const headers[]);
-       void (*header_lookup_ref)(struct mailbox_header_lookup_ctx *ctx);
-       void (*header_lookup_unref)(struct mailbox_header_lookup_ctx *ctx);
+       void (*header_lookup_deinit)(struct mailbox_header_lookup_ctx *ctx);
 
        struct mail_search_context *
        (*search_init)(struct mailbox_transaction_context *t,
@@ -390,6 +389,7 @@ struct mailbox_sync_context {
 struct mailbox_header_lookup_ctx {
        struct mailbox *box;
        const char *const *headers;
+       int refcount;
 };
 
 /* Modules should use do "my_id = mail_storage_module_id++" and
index e3bb95a2399d740ea71166e41a14c88d1546c525..fdefc3c3ca1cad950395a2d350ebfc1c3eb1bd9e 100644 (file)
@@ -721,7 +721,8 @@ mailbox_header_lookup_init(struct mailbox *box, const char *const headers[])
 
 void mailbox_header_lookup_ref(struct mailbox_header_lookup_ctx *ctx)
 {
-       ctx->box->v.header_lookup_ref(ctx);
+       i_assert(ctx->refcount > 0);
+       ctx->refcount++;
 }
 
 void mailbox_header_lookup_unref(struct mailbox_header_lookup_ctx **_ctx)
@@ -729,7 +730,12 @@ void mailbox_header_lookup_unref(struct mailbox_header_lookup_ctx **_ctx)
        struct mailbox_header_lookup_ctx *ctx = *_ctx;
 
        *_ctx = NULL;
-       ctx->box->v.header_lookup_unref(ctx);
+
+       i_assert(ctx->refcount > 0);
+       if (--ctx->refcount > 0)
+               return;
+
+       ctx->box->v.header_lookup_deinit(ctx);
 }
 
 struct mail_search_context *
index 73987ca8d89007752bdd0db9e98c19bca715a0ab..1dcf02bf9a92e3001a6eb5a362acdb3e3fd7eb39 100644 (file)
@@ -617,8 +617,7 @@ struct mailbox virtual_mailbox = {
                virtual_get_virtual_box_patterns,
                virtual_mail_alloc,
                index_header_lookup_init,
-               index_header_lookup_ref,
-               index_header_lookup_unref,
+               index_header_lookup_deinit,
                virtual_search_init,
                virtual_search_deinit,
                virtual_search_next_nonblock,