dovecot-2.2: lib-storage: Partially reverted previous change. Ad...

dovecot at dovecot.org dovecot at dovecot.org
Tue Oct 21 02:47:21 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/d9f49ebe5e78
changeset: 17975:d9f49ebe5e78
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Oct 21 05:44:09 2014 +0300
description:
lib-storage: Partially reverted previous change. Added mailbox_list_index_sync_delete() instead.

diffstat:

 src/lib-storage/list/mailbox-list-index-backend.c |  19 +++++++++++++++++--
 src/lib-storage/list/mailbox-list-index-sync.c    |  18 ++++--------------
 src/lib-storage/list/mailbox-list-index-sync.h    |   4 ++--
 3 files changed, 23 insertions(+), 18 deletions(-)

diffs (104 lines):

diff -r c92472804eb8 -r d9f49ebe5e78 src/lib-storage/list/mailbox-list-index-backend.c
--- a/src/lib-storage/list/mailbox-list-index-backend.c	Tue Oct 21 03:58:56 2014 +0300
+++ b/src/lib-storage/list/mailbox-list-index-backend.c	Tue Oct 21 05:44:09 2014 +0300
@@ -453,6 +453,21 @@
 }
 
 static int
+index_list_delete_entry(struct mailbox_list *list, const char *name,
+			bool delete_selectable)
+{
+	struct mailbox_list_index_sync_context *sync_ctx;
+	int ret;
+
+	if (mailbox_list_index_sync_begin(list, &sync_ctx) < 0)
+		return -1;
+	ret = mailbox_list_index_sync_delete(sync_ctx, name, delete_selectable);
+	if (mailbox_list_index_sync_end(&sync_ctx, TRUE) < 0)
+		return -1;
+	return ret;
+}
+
+static int
 index_list_delete_mailbox(struct mailbox_list *_list, const char *name)
 {
 	const char *path;
@@ -476,7 +491,7 @@
 	if (ret == 0 || (_list->props & MAILBOX_LIST_PROP_AUTOCREATE_DIRS) != 0)
 		index_list_delete_finish(_list, name);
 	if (ret == 0) {
-		if (mailbox_list_index_delete_entry(_list, name, TRUE) < 0)
+		if (index_list_delete_entry(_list, name, TRUE) < 0)
 			return -1;
 	}
 	return ret;
@@ -487,7 +502,7 @@
 {
 	int ret;
 
-	if ((ret = mailbox_list_index_delete_entry(_list, name, FALSE)) < 0)
+	if ((ret = index_list_delete_entry(_list, name, FALSE)) < 0)
 		return -1;
 	if (ret == 0) {
 		mailbox_list_set_error(_list, MAIL_ERROR_EXISTS,
diff -r c92472804eb8 -r d9f49ebe5e78 src/lib-storage/list/mailbox-list-index-sync.c
--- a/src/lib-storage/list/mailbox-list-index-sync.c	Tue Oct 21 03:58:56 2014 +0300
+++ b/src/lib-storage/list/mailbox-list-index-sync.c	Tue Oct 21 05:44:09 2014 +0300
@@ -395,23 +395,18 @@
 	return mailbox_list_index_sync_end(&sync_ctx, ret == 0);
 }
 
-int mailbox_list_index_delete_entry(struct mailbox_list *list, const char *name,
-				    bool delete_selectable)
+int mailbox_list_index_sync_delete(struct mailbox_list_index_sync_context *sync_ctx,
+				   const char *name, bool delete_selectable)
 {
-	struct mailbox_list_index_sync_context *sync_ctx;
 	struct mailbox_list_index_record rec;
 	struct mailbox_list_index_node *node;
 	const void *data;
 	bool expunged;
 	uint32_t seq;
 
-	if (mailbox_list_index_sync_begin(list, &sync_ctx) < 0)
-		return -1;
-
-	node = mailbox_list_index_lookup(list, name);
+	node = mailbox_list_index_lookup(sync_ctx->list, name);
 	if (node == NULL) {
-		(void)mailbox_list_index_sync_end(&sync_ctx, FALSE);
-		mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+		mailbox_list_set_error(sync_ctx->list, MAIL_ERROR_NOTFOUND,
 				       T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
 		return -1;
 	}
@@ -436,16 +431,11 @@
 	if (node->children != NULL) {
 		/* can't delete this directory before its children,
 		   but we may have made it non-selectable already */
-		if (mailbox_list_index_sync_end(&sync_ctx, TRUE) < 0)
-			return -1;
 		return 0;
 	}
 
 	/* we can remove the entire node */
 	mail_index_expunge(sync_ctx->trans, seq);
 	mailbox_list_index_node_unlink(sync_ctx->ilist, node);
-
-	if (mailbox_list_index_sync_end(&sync_ctx, TRUE) < 0)
-		return -1;
 	return 1;
 }
diff -r c92472804eb8 -r d9f49ebe5e78 src/lib-storage/list/mailbox-list-index-sync.h
--- a/src/lib-storage/list/mailbox-list-index-sync.h	Tue Oct 21 03:58:56 2014 +0300
+++ b/src/lib-storage/list/mailbox-list-index-sync.h	Tue Oct 21 05:44:09 2014 +0300
@@ -29,7 +29,7 @@
 				      struct mailbox_list_index_node **node_r,
 				      bool *created_r);
 
-int mailbox_list_index_delete_entry(struct mailbox_list *list, const char *name,
-				    bool delete_selectable);
+int mailbox_list_index_sync_delete(struct mailbox_list_index_sync_context *sync_ctx,
+				   const char *name, bool delete_selectable);
 
 #endif


More information about the dovecot-cvs mailing list