dovecot-2.2: doveadm_mail_iter_init(): Removed unnecessarily ret...

dovecot at dovecot.org dovecot at dovecot.org
Mon May 6 17:27:51 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/7808096bb674
changeset: 16332:7808096bb674
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 06 17:27:36 2013 +0300
description:
doveadm_mail_iter_init(): Removed unnecessarily returning transaction.
If it's needed in future just add a new doveadm_mail_iter_get_transaction().

diffstat:

 src/doveadm/doveadm-mail-altmove.c  |  3 +--
 src/doveadm/doveadm-mail-copymove.c |  3 +--
 src/doveadm/doveadm-mail-expunge.c  |  3 +--
 src/doveadm/doveadm-mail-fetch.c    |  3 +--
 src/doveadm/doveadm-mail-import.c   |  3 +--
 src/doveadm/doveadm-mail-iter.c     |  8 +++++---
 src/doveadm/doveadm-mail-iter.h     |  2 +-
 src/doveadm/doveadm-mail-search.c   |  5 ++---
 8 files changed, 13 insertions(+), 17 deletions(-)

diffs (160 lines):

diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-altmove.c
--- a/src/doveadm/doveadm-mail-altmove.c	Mon May 06 16:43:29 2013 +0300
+++ b/src/doveadm/doveadm-mail-altmove.c	Mon May 06 17:27:36 2013 +0300
@@ -20,13 +20,12 @@
 		struct mail_search_args *search_args, bool reverse)
 {
 	struct doveadm_mail_iter *iter;
-	struct mailbox_transaction_context *trans;
 	struct mail *mail;
 	enum modify_type modify_type =
 		!reverse ? MODIFY_ADD : MODIFY_REMOVE;
 
 	if (doveadm_mail_iter_init(ctx, info, search_args, 0, NULL,
-				   &trans, &iter) < 0)
+				   &iter) < 0)
 		return -1;
 
 	while (doveadm_mail_iter_next(iter, &mail)) {
diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-copymove.c
--- a/src/doveadm/doveadm-mail-copymove.c	Mon May 06 16:43:29 2013 +0300
+++ b/src/doveadm/doveadm-mail-copymove.c	Mon May 06 17:27:36 2013 +0300
@@ -25,14 +25,13 @@
 	     const struct mailbox_info *info)
 {
 	struct doveadm_mail_iter *iter;
-	struct mailbox_transaction_context *trans;
 	struct mailbox_transaction_context *desttrans;
 	struct mail_save_context *save_ctx;
 	struct mail *mail;
 	int ret = 0;
 
 	if (doveadm_mail_iter_init(&ctx->ctx, info, ctx->ctx.search_args, 0,
-				   NULL, &trans, &iter) < 0)
+				   NULL, &iter) < 0)
 		return -1;
 
 	/* use a separately committed transaction for each mailbox.
diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-expunge.c
--- a/src/doveadm/doveadm-mail-expunge.c	Mon May 06 16:43:29 2013 +0300
+++ b/src/doveadm/doveadm-mail-expunge.c	Mon May 06 17:27:36 2013 +0300
@@ -22,13 +22,12 @@
 	struct expunge_cmd_context *ctx = (struct expunge_cmd_context *)_ctx;
 	struct doveadm_mail_iter *iter;
 	struct mailbox *box;
-	struct mailbox_transaction_context *trans;
 	struct mail *mail;
 	enum mail_error error;
 	int ret = 0;
 
 	if (doveadm_mail_iter_init(_ctx, info, search_args, 0, NULL,
-				   &trans, &iter) < 0)
+				   &iter) < 0)
 		return -1;
 
 	while (doveadm_mail_iter_next(iter, &mail)) {
diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-fetch.c
--- a/src/doveadm/doveadm-mail-fetch.c	Mon May 06 16:43:29 2013 +0300
+++ b/src/doveadm/doveadm-mail-fetch.c	Mon May 06 17:27:36 2013 +0300
@@ -507,13 +507,12 @@
 cmd_fetch_box(struct fetch_cmd_context *ctx, const struct mailbox_info *info)
 {
 	struct doveadm_mail_iter *iter;
-	struct mailbox_transaction_context *trans;
 	int ret = 0;
 
 	if (doveadm_mail_iter_init(&ctx->ctx, info, ctx->ctx.search_args,
 				   ctx->wanted_fields,
 				   array_idx(&ctx->header_fields, 0),
-				   &trans, &iter) < 0)
+				   &iter) < 0)
 		return -1;
 
 	while (doveadm_mail_iter_next(iter, &ctx->mail)) {
diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-import.c
--- a/src/doveadm/doveadm-mail-import.c	Mon May 06 16:43:29 2013 +0300
+++ b/src/doveadm/doveadm-mail-import.c	Mon May 06 17:27:36 2013 +0300
@@ -103,13 +103,12 @@
 	       struct mail_search_args *search_args)
 {
 	struct doveadm_mail_iter *iter;
-	struct mailbox_transaction_context *trans;
 	struct mailbox *box;
 	struct mail *mail;
 	int ret = 0;
 
 	if (doveadm_mail_iter_init(&ctx->ctx, info, search_args, 0, NULL,
-				   &trans, &iter) < 0)
+				   &iter) < 0)
 		return -1;
 
 	if (doveadm_mail_iter_next(iter, &mail)) {
diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-iter.c
--- a/src/doveadm/doveadm-mail-iter.c	Mon May 06 16:43:29 2013 +0300
+++ b/src/doveadm/doveadm-mail-iter.c	Mon May 06 17:27:36 2013 +0300
@@ -21,7 +21,6 @@
 			   struct mail_search_args *search_args,
 			   enum mail_fetch_field wanted_fields,
 			   const char *const *wanted_headers,
-			   struct mailbox_transaction_context **trans_r,
 			   struct doveadm_mail_iter **iter_r)
 {
 	struct doveadm_mail_iter *iter;
@@ -49,8 +48,6 @@
 	iter->t = mailbox_transaction_begin(iter->box, 0);
 	iter->search_ctx = mailbox_search_init(iter->t, search_args, NULL,
 					       wanted_fields, headers_ctx);
-
-	*trans_r = iter->t;
 	*iter_r = iter;
 	return 0;
 }
@@ -128,3 +125,8 @@
 {
 	return mailbox_search_next(iter->search_ctx, mail_r);
 }
+
+struct mailbox *doveadm_mail_iter_get_mailbox(struct doveadm_mail_iter *iter)
+{
+	return iter->box;
+}
diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-iter.h
--- a/src/doveadm/doveadm-mail-iter.h	Mon May 06 16:43:29 2013 +0300
+++ b/src/doveadm/doveadm-mail-iter.h	Mon May 06 17:27:36 2013 +0300
@@ -11,13 +11,13 @@
 			   struct mail_search_args *search_args,
 			   enum mail_fetch_field wanted_fields,
 			   const char *const *wanted_headers,
-			   struct mailbox_transaction_context **trans_r,
 			   struct doveadm_mail_iter **iter_r) ATTR_NULL(5);
 int doveadm_mail_iter_deinit(struct doveadm_mail_iter **iter);
 int doveadm_mail_iter_deinit_sync(struct doveadm_mail_iter **iter);
 int doveadm_mail_iter_deinit_keep_box(struct doveadm_mail_iter **iter,
 				      struct mailbox **box_r);
 void doveadm_mail_iter_deinit_rollback(struct doveadm_mail_iter **iter);
+struct mailbox *doveadm_mail_iter_get_mailbox(struct doveadm_mail_iter *iter);
 
 bool doveadm_mail_iter_next(struct doveadm_mail_iter *iter,
 			    struct mail **mail_r);
diff -r 664ec741de8c -r 7808096bb674 src/doveadm/doveadm-mail-search.c
--- a/src/doveadm/doveadm-mail-search.c	Mon May 06 16:43:29 2013 +0300
+++ b/src/doveadm/doveadm-mail-search.c	Mon May 06 17:27:36 2013 +0300
@@ -15,16 +15,15 @@
 {
 	struct doveadm_mail_iter *iter;
 	struct mailbox *box;
-	struct mailbox_transaction_context *trans;
 	struct mail *mail;
 	struct mailbox_metadata metadata;
 	const char *guid_str;
 	int ret = 0;
 
 	if (doveadm_mail_iter_init(ctx, info, ctx->search_args, 0, NULL,
-				   &trans, &iter) < 0)
+				   &iter) < 0)
 		return -1;
-	box = mailbox_transaction_get_mailbox(trans);
+	box = doveadm_mail_iter_get_mailbox(iter);
 
 	if (mailbox_get_metadata(box, MAILBOX_METADATA_GUID, &metadata) < 0) {
 		ret = -1;


More information about the dovecot-cvs mailing list