dovecot-2.2: module-dir: Allow plugins to have deinit() function...

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 30 12:12:06 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/70f1d2bb0bd9
changeset: 16899:70f1d2bb0bd9
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 30 12:11:54 2013 +0200
description:
module-dir: Allow plugins to have deinit() function without init() function

diffstat:

 src/lib/module-dir.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 2c09cd664a95 -r 70f1d2bb0bd9 src/lib/module-dir.c
--- a/src/lib/module-dir.c	Tue Oct 29 21:16:05 2013 +0200
+++ b/src/lib/module-dir.c	Wed Oct 30 12:11:54 2013 +0200
@@ -242,7 +242,7 @@
 	module->init = (void (*)(struct module *))
 		get_symbol(module, t_strconcat(name, "_init", NULL),
 			   !set->require_init_funcs);
-	module->deinit = module->init == NULL ? NULL : (void (*)(void))
+	module->deinit = (void (*)(void))
 		get_symbol(module, t_strconcat(name, "_deinit", NULL),
 			   !set->require_init_funcs);
 
@@ -492,10 +492,12 @@
 	struct module *module;
 
 	for (module = modules; module != NULL; module = module->next) {
-		if (module->init != NULL && !module->initialized) T_BEGIN {
+		if (!module->initialized) {
 			module->initialized = TRUE;
-			module->init(module);
-		} T_END;
+			if (module->init != NULL) T_BEGIN {
+				module->init(module);
+			} T_END;
+		}
 	}
 }
 


More information about the dovecot-cvs mailing list