dovecot-2.0: mailbox_header_lookup*() private API changed.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jun 5 02:30:55 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/87e533f1127d
changeset: 9454:87e533f1127d
user: Timo Sirainen <tss at iki.fi>
date: Thu Jun 04 19:30:46 2009 -0400
description:
mailbox_header_lookup*() private API changed.
diffstat:
10 files changed, 19 insertions(+), 27 deletions(-)
src/lib-storage/index/cydir/cydir-storage.c | 3 +--
src/lib-storage/index/dbox/dbox-storage.c | 3 +--
src/lib-storage/index/index-mail-headers.c | 11 ++---------
src/lib-storage/index/index-storage.h | 3 +--
src/lib-storage/index/maildir/maildir-storage.c | 3 +--
src/lib-storage/index/mbox/mbox-storage.c | 3 +--
src/lib-storage/index/raw/raw-storage.c | 3 +--
src/lib-storage/mail-storage-private.h | 4 ++--
src/lib-storage/mail-storage.c | 10 ++++++++--
src/plugins/virtual/virtual-storage.c | 3 +--
diffs (170 lines):
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/index/cydir/cydir-storage.c
--- a/src/lib-storage/index/cydir/cydir-storage.c Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/index/cydir/cydir-storage.c Thu Jun 04 19:30:46 2009 -0400
@@ -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,
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/index/dbox/dbox-storage.c
--- a/src/lib-storage/index/dbox/dbox-storage.c Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/index/dbox/dbox-storage.c Thu Jun 04 19:30:46 2009 -0400
@@ -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,
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/index/index-mail-headers.c
--- a/src/lib-storage/index/index-mail-headers.c Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/index/index-mail-headers.c Thu Jun 04 19:30:46 2009 -0400
@@ -885,6 +885,7 @@ index_header_lookup_init_real(struct mai
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,18 +912,10 @@ index_header_lookup_init(struct mailbox
return ctx;
}
-void index_header_lookup_ref(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;
- pool_ref(ctx->pool);
-}
-
-void index_header_lookup_unref(struct mailbox_header_lookup_ctx *_ctx)
-{
- struct index_header_lookup_ctx *ctx =
- (struct index_header_lookup_ctx *)_ctx;
-
pool_unref(&ctx->pool);
}
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/index/index-storage.h
--- a/src/lib-storage/index/index-storage.h Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/index/index-storage.h Thu Jun 04 19:30:46 2009 -0400
@@ -150,8 +150,7 @@ bool index_storage_get_expunged_uids(str
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,
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-storage.c Thu Jun 04 19:30:46 2009 -0400
@@ -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,
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/index/mbox/mbox-storage.c Thu Jun 04 19:30:46 2009 -0400
@@ -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,
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/index/raw/raw-storage.c
--- a/src/lib-storage/index/raw/raw-storage.c Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/index/raw/raw-storage.c Thu Jun 04 19:30:46 2009 -0400
@@ -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,
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/mail-storage-private.h Thu Jun 04 19:30:46 2009 -0400
@@ -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_header_lookup_ctx {
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
diff -r 2a3390530f6a -r 87e533f1127d src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c Thu Jun 04 18:58:38 2009 -0400
+++ b/src/lib-storage/mail-storage.c Thu Jun 04 19:30:46 2009 -0400
@@ -721,7 +721,8 @@ mailbox_header_lookup_init(struct mailbo
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
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 *
diff -r 2a3390530f6a -r 87e533f1127d src/plugins/virtual/virtual-storage.c
--- a/src/plugins/virtual/virtual-storage.c Thu Jun 04 18:58:38 2009 -0400
+++ b/src/plugins/virtual/virtual-storage.c Thu Jun 04 19:30:46 2009 -0400
@@ -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,
More information about the dovecot-cvs
mailing list