dovecot-1.2: mail_search_args_[de]init() calls stack now. Last u...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Apr 16 03:21:01 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/77fb2731830b
changeset: 8951:77fb2731830b
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 15 20:20:39 2009 -0400
description:
mail_search_args_[de]init() calls stack now. Last unref is still allowed without deiniting.
diffstat:
2 files changed, 11 insertions(+), 9 deletions(-)
src/lib-storage/mail-search.c | 16 +++++++++-------
src/lib-storage/mail-search.h | 4 ++--
diffs (66 lines):
diff -r ec1ae90af21a -r 77fb2731830b src/lib-storage/mail-search.c
--- a/src/lib-storage/mail-search.c Wed Apr 15 19:48:55 2009 -0400
+++ b/src/lib-storage/mail-search.c Wed Apr 15 20:20:39 2009 -0400
@@ -122,11 +122,10 @@ void mail_search_args_init(struct mail_s
struct mailbox *box, bool change_uidsets,
const ARRAY_TYPE(seq_range) *search_saved_uidset)
{
- if (args->initialized) {
+ if (args->init_refcount++ > 0) {
i_assert(args->box == box);
return;
}
- args->initialized = TRUE;
args->box = box;
if (!args->simplified)
@@ -168,11 +167,11 @@ static void mail_search_args_deinit_sub(
void mail_search_args_deinit(struct mail_search_args *args)
{
- if (!args->initialized)
+ i_assert(args->init_refcount > 0);
+ if (--args->init_refcount > 0)
return;
mail_search_args_deinit_sub(args, args->args);
- args->initialized = FALSE;
args->box = NULL;
}
@@ -230,10 +229,13 @@ void mail_search_args_unref(struct mail_
i_assert(args->refcount > 0);
*_args = NULL;
- if (--args->refcount > 0)
+ if (--args->refcount > 0) {
+ i_assert(args->init_refcount <= args->refcount);
return;
-
- mail_search_args_deinit(args);
+ }
+ i_assert(args->init_refcount <= 1);
+ if (args->init_refcount == 1)
+ mail_search_args_deinit(args);
pool_unref(&args->pool);
}
diff -r ec1ae90af21a -r 77fb2731830b src/lib-storage/mail-search.h
--- a/src/lib-storage/mail-search.h Wed Apr 15 19:48:55 2009 -0400
+++ b/src/lib-storage/mail-search.h Wed Apr 15 20:20:39 2009 -0400
@@ -93,13 +93,13 @@ struct mail_search_arg {
};
struct mail_search_args {
- int refcount;
+ int refcount, init_refcount;
+
pool_t pool;
struct mailbox *box;
struct mail_search_arg *args;
const char *charset;
- unsigned int initialized:1;
unsigned int simplified:1;
unsigned int have_inthreads:1;
};
More information about the dovecot-cvs
mailing list