dovecot-2.0: struct mail_storage.callbacks is no longer a pointer.

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 5 01:58:46 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/2a3390530f6a
changeset: 9453:2a3390530f6a
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 04 18:58:38 2009 -0400
description:
struct mail_storage.callbacks is no longer a pointer.

diffstat:

6 files changed, 17 insertions(+), 20 deletions(-)
src/lib-storage/index/index-search.c         |    4 ++--
src/lib-storage/index/index-storage.c        |   12 ++++++------
src/lib-storage/index/maildir/maildir-sync.c |    8 ++++----
src/lib-storage/mail-storage-private.h       |    2 +-
src/lib-storage/mail-storage.c               |    5 +----
src/plugins/fts/fts-storage.c                |    6 +++---

diffs (142 lines):

diff -r d9f5cc5365d1 -r 2a3390530f6a src/lib-storage/index/index-search.c
--- a/src/lib-storage/index/index-search.c	Thu Jun 04 17:12:19 2009 -0400
+++ b/src/lib-storage/index/index-search.c	Thu Jun 04 18:58:38 2009 -0400
@@ -1116,7 +1116,7 @@ static void index_storage_search_notify(
 		/* set the search time in here, in case a plugin
 		   already spent some time indexing the mailbox */
 		ctx->search_start_time = ioloop_timeval;
-	} else if (box->storage->callbacks->notify_ok != NULL &&
+	} else if (box->storage->callbacks.notify_ok != NULL &&
 		   !ctx->mail_ctx.progress_hidden) {
 		percentage = ctx->mail_ctx.progress_cur * 100.0 /
 			ctx->mail_ctx.progress_max;
@@ -1132,7 +1132,7 @@ static void index_storage_search_notify(
 			text = t_strdup_printf("Searched %d%% of the mailbox, "
 					       "ETA %d:%02d", (int)percentage,
 					       secs/60, secs%60);
-			box->storage->callbacks->
+			box->storage->callbacks.
 				notify_ok(box, text,
 					  box->storage->callback_context);
 		} T_END;
diff -r d9f5cc5365d1 -r 2a3390530f6a src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Thu Jun 04 17:12:19 2009 -0400
+++ b/src/lib-storage/index/index-storage.c	Thu Jun 04 18:58:38 2009 -0400
@@ -339,22 +339,22 @@ void index_storage_lock_notify(struct in
 	case MAILBOX_LOCK_NOTIFY_NONE:
 		break;
 	case MAILBOX_LOCK_NOTIFY_MAILBOX_ABORT:
-		if (storage->callbacks->notify_no == NULL)
+		if (storage->callbacks.notify_no == NULL)
 			break;
 
 		str = t_strdup_printf("Mailbox is locked, will abort in "
 				      "%u seconds", secs_left);
-		storage->callbacks->notify_no(&ibox->box, str,
-					      storage->callback_context);
+		storage->callbacks.notify_no(&ibox->box, str,
+					     storage->callback_context);
 		break;
 	case MAILBOX_LOCK_NOTIFY_MAILBOX_OVERRIDE:
-		if (storage->callbacks->notify_ok == NULL)
+		if (storage->callbacks.notify_ok == NULL)
 			break;
 
 		str = t_strdup_printf("Stale mailbox lock file detected, "
 				      "will override in %u seconds", secs_left);
-		storage->callbacks->notify_ok(&ibox->box, str,
-					      storage->callback_context);
+		storage->callbacks.notify_ok(&ibox->box, str,
+					     storage->callback_context);
 		break;
 	}
 }
diff -r d9f5cc5365d1 -r 2a3390530f6a src/lib-storage/index/maildir/maildir-sync.c
--- a/src/lib-storage/index/maildir/maildir-sync.c	Thu Jun 04 17:12:19 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-sync.c	Thu Jun 04 18:58:38 2009 -0400
@@ -238,8 +238,8 @@ void maildir_sync_notify(struct maildir_
 	if (now - ctx->last_notify > MAIL_STORAGE_STAYALIVE_SECS) {
 		struct mailbox *box = &ctx->mbox->ibox.box;
 
-		if (box->storage->callbacks->notify_ok != NULL) {
-			box->storage->callbacks->
+		if (box->storage->callbacks.notify_ok != NULL) {
+			box->storage->callbacks.
 				notify_ok(box, "Hang in there..",
 					  box->storage->callback_context);
 		}
@@ -793,8 +793,8 @@ static int maildir_sync_context(struct m
 			return -1;
 		}
 
-		if (storage->callbacks->notify_no != NULL) {
-			storage->callbacks->notify_no(&ctx->mbox->ibox.box,
+		if (storage->callbacks.notify_no != NULL) {
+			storage->callbacks.notify_no(&ctx->mbox->ibox.box,
 				"Internal mailbox synchronization failure, "
 				"showing only old mails.",
 				storage->callback_context);
diff -r d9f5cc5365d1 -r 2a3390530f6a src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Thu Jun 04 17:12:19 2009 -0400
+++ b/src/lib-storage/mail-storage-private.h	Thu Jun 04 18:58:38 2009 -0400
@@ -89,7 +89,7 @@ struct mail_storage {
 
 	enum mail_storage_flags flags;
 
-	struct mail_storage_callbacks *callbacks;
+	struct mail_storage_callbacks callbacks;
 	void *callback_context;
 
 	/* Module-specific contexts. See mail_storage_module_id. */
diff -r d9f5cc5365d1 -r 2a3390530f6a src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Thu Jun 04 17:12:19 2009 -0400
+++ b/src/lib-storage/mail-storage.c	Thu Jun 04 18:58:38 2009 -0400
@@ -286,9 +286,6 @@ int mail_storage_create(struct mail_name
 	storage->user = ns->user;
 	storage->set = ns->mail_set;
 	storage->flags = flags;
-
-	storage->callbacks =
-		p_new(storage->pool, struct mail_storage_callbacks, 1);
 	p_array_init(&storage->module_contexts, storage->pool, 5);
 
 	if (storage->v.create != NULL &&
@@ -388,7 +385,7 @@ void mail_storage_set_callbacks(struct m
 				struct mail_storage_callbacks *callbacks,
 				void *context)
 {
-	*storage->callbacks = *callbacks;
+	storage->callbacks = *callbacks;
 	storage->callback_context = context;
 }
 
diff -r d9f5cc5365d1 -r 2a3390530f6a src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c	Thu Jun 04 17:12:19 2009 -0400
+++ b/src/plugins/fts/fts-storage.c	Thu Jun 04 18:58:38 2009 -0400
@@ -480,7 +480,7 @@ static int fts_build_deinit(struct fts_s
 	if (ioloop_time - ctx->search_start_time.tv_sec >=
 	    FTS_BUILD_NOTIFY_INTERVAL_SECS) {
 		/* we notified at least once */
-		box->storage->callbacks->
+		box->storage->callbacks.
 			notify_ok(box, "Mailbox indexing finished",
 				  box->storage->callback_context);
 	}
@@ -502,7 +502,7 @@ static void fts_build_notify(struct fts_
 		/* set the search time in here, in case a plugin
 		   already spent some time indexing the mailbox */
 		ctx->search_start_time = ioloop_timeval;
-	} else if (box->storage->callbacks->notify_ok != NULL) {
+	} else if (box->storage->callbacks.notify_ok != NULL) {
 		range = array_idx(&ctx->search_args->args->value.seqset, 0);
 		percentage = (ctx->mail->seq - range->seq1) * 100.0 /
 			(range->seq2 - range->seq1);
@@ -518,7 +518,7 @@ static void fts_build_notify(struct fts_
 			text = t_strdup_printf("Indexed %d%% of the mailbox, "
 					       "ETA %d:%02d", (int)percentage,
 					       secs/60, secs%60);
-			box->storage->callbacks->
+			box->storage->callbacks.
 				notify_ok(box, text,
 				box->storage->callback_context);
 		} T_END;


More information about the dovecot-cvs mailing list