dovecot-2.2: lib-storage: Code cleanup - Don't keep a separate n...

dovecot at dovecot.org dovecot at dovecot.org
Wed Aug 19 10:42:44 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/3a8af59b379d
changeset: 18976:3a8af59b379d
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Aug 19 13:40:35 2015 +0300
description:
lib-storage: Code cleanup - Don't keep a separate notify_ios list.

diffstat:

 src/lib-storage/index/index-mailbox-check.c |  25 ++++---------------------
 src/lib-storage/index/index-storage.h       |   1 -
 2 files changed, 4 insertions(+), 22 deletions(-)

diffs (77 lines):

diff -r f78bd5be4e47 -r 3a8af59b379d src/lib-storage/index/index-mailbox-check.c
--- a/src/lib-storage/index/index-mailbox-check.c	Wed Aug 19 12:56:55 2015 +0300
+++ b/src/lib-storage/index/index-mailbox-check.c	Wed Aug 19 13:40:35 2015 +0300
@@ -16,11 +16,7 @@
 
 	char *path;
 	time_t last_stamp;
-};
-
-struct index_notify_io {
-	struct index_notify_io *next;
-	struct io *io;
+	struct io *io_notify;
 };
 
 static void notify_delay_callback(struct mailbox *box)
@@ -71,21 +67,15 @@
 	struct index_notify_file *file;
 	struct stat st;
 	struct io *io = NULL;
-	struct index_notify_io *aio;
 
 	i_assert(set->mailbox_idle_check_interval > 0);
 
 	(void)io_add_notify(path, notify_callback, box, &io);
-	if (io != NULL) {
-		aio = i_new(struct index_notify_io, 1);
-		aio->io = io;
-		aio->next = ibox->notify_ios;
-		ibox->notify_ios = aio;
-	}
 
 	file = i_new(struct index_notify_file, 1);
 	file->path = i_strdup(path);
 	file->last_stamp = stat(path, &st) < 0 ? 0 : st.st_mtime;
+	file->io_notify = io;
 
 	file->next = ibox->notify_files;
 	ibox->notify_files = file;
@@ -104,24 +94,17 @@
 {
 	struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
 	struct index_notify_file *file;
-	struct index_notify_io *aio;
 
 	while (ibox->notify_files != NULL) {
 		file = ibox->notify_files;
 		ibox->notify_files = file->next;
 
+		if (file->io_notify != NULL)
+			io_remove(&file->io_notify);
                 i_free(file->path);
 		i_free(file);
 	}
 
-	while (ibox->notify_ios != NULL) {
-		aio = ibox->notify_ios;
-		ibox->notify_ios = aio->next;
-
-		io_remove(&aio->io);
-		i_free(aio);
-	}
-
 	if (ibox->notify_delay_to != NULL)
 		timeout_remove(&ibox->notify_delay_to);
 	if (ibox->notify_to != NULL)
diff -r f78bd5be4e47 -r 3a8af59b379d src/lib-storage/index/index-storage.h
--- a/src/lib-storage/index/index-storage.h	Wed Aug 19 12:56:55 2015 +0300
+++ b/src/lib-storage/index/index-storage.h	Wed Aug 19 13:40:35 2015 +0300
@@ -23,7 +23,6 @@
 
 	struct timeout *notify_to, *notify_delay_to;
 	struct index_notify_file *notify_files;
-        struct index_notify_io *notify_ios;
 
 	time_t next_lock_notify; /* temporary */
 	enum mailbox_lock_notify_type last_notify_type;


More information about the dovecot-cvs mailing list