dovecot-2.0: doveadm: Minor code cleanup.

dovecot at dovecot.org dovecot at dovecot.org
Thu May 13 13:07:19 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/b73e0f51dad1
changeset: 11301:b73e0f51dad1
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 13 12:07:16 2010 +0200
description:
doveadm: Minor code cleanup.

diffstat:

 src/doveadm/doveadm.c |  25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diffs (49 lines):

diff -r 76d4b3ac7bfa -r b73e0f51dad1 src/doveadm/doveadm.c
--- a/src/doveadm/doveadm.c	Thu May 13 12:05:24 2010 +0200
+++ b/src/doveadm/doveadm.c	Thu May 13 12:07:16 2010 +0200
@@ -157,6 +157,19 @@
 	module_dir_init(modules);
 }
 
+
+static struct doveadm_cmd *doveadm_commands[] = {
+	&doveadm_cmd_help,
+	&doveadm_cmd_auth,
+	&doveadm_cmd_user,
+	&doveadm_cmd_dump,
+	&doveadm_cmd_pw,
+	&doveadm_cmd_who,
+	&doveadm_cmd_penalty,
+	&doveadm_cmd_kick,
+	&doveadm_cmd_mailbox_convert
+};
+
 int main(int argc, char *argv[])
 {
 	const struct setting_parser_info *set_roots[] = {
@@ -167,6 +180,7 @@
 		MASTER_SERVICE_FLAG_STANDALONE |
 		MASTER_SERVICE_FLAG_KEEP_CONFIG_OPEN;
 	const char *cmd_name, *error;
+	unsigned int i;
 	int c;
 
 	/* "+" is GNU extension to stop at the first non-option.
@@ -193,15 +207,8 @@
 	doveadm_settings = master_service_settings_get_others(master_service)[0];
 
 	i_array_init(&doveadm_cmds, 32);
-	doveadm_register_cmd(&doveadm_cmd_help);
-	doveadm_register_cmd(&doveadm_cmd_auth);
-	doveadm_register_cmd(&doveadm_cmd_user);
-	doveadm_register_cmd(&doveadm_cmd_dump);
-	doveadm_register_cmd(&doveadm_cmd_pw);
-	doveadm_register_cmd(&doveadm_cmd_who);
-	doveadm_register_cmd(&doveadm_cmd_penalty);
-	doveadm_register_cmd(&doveadm_cmd_kick);
-	doveadm_register_cmd(&doveadm_cmd_mailbox_convert);
+	for (i = 0; i < N_ELEMENTS(doveadm_commands); i++)
+		doveadm_register_cmd(doveadm_commands[i]);
 	doveadm_mail_init();
 	doveadm_load_modules();
 


More information about the dovecot-cvs mailing list