dovecot-2.2: lmtp: Small code cleanup

dovecot at dovecot.org dovecot at dovecot.org
Fri Jul 4 11:19:33 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/16d30ea1e692
changeset: 17602:16d30ea1e692
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 04 14:17:54 2014 +0300
description:
lmtp: Small code cleanup

diffstat:

 src/lmtp/client.h   |   1 -
 src/lmtp/commands.c |  21 ++++++---------------
 2 files changed, 6 insertions(+), 16 deletions(-)

diffs (55 lines):

diff -r d0d9f79a71eb -r 16d30ea1e692 src/lmtp/client.h
--- a/src/lmtp/client.h	Fri Jul 04 14:16:16 2014 +0300
+++ b/src/lmtp/client.h	Fri Jul 04 14:17:54 2014 +0300
@@ -16,7 +16,6 @@
 	const char *session_id;
 	const char *mail_from;
 	ARRAY(struct mail_recipient) rcpt_to;
-	unsigned int rcpt_idx;
 
 	unsigned int data_end_idx;
 
diff -r d0d9f79a71eb -r 16d30ea1e692 src/lmtp/commands.c
--- a/src/lmtp/commands.c	Fri Jul 04 14:16:16 2014 +0300
+++ b/src/lmtp/commands.c	Fri Jul 04 14:17:54 2014 +0300
@@ -715,25 +715,17 @@
 	return ret;
 }
 
-static bool client_deliver_next(struct client *client,
-				struct mail_deliver_session *session)
+static void client_deliver_mails(struct client *client,
+				 struct mail_deliver_session *session)
 {
 	const struct mail_recipient *rcpts;
-	unsigned int count;
-	int ret;
+	unsigned int i, count;
 
 	rcpts = array_get(&client->state.rcpt_to, &count);
-	while (client->state.rcpt_idx < count) {
-		ret = client_deliver(client, &rcpts[client->state.rcpt_idx],
-				     session);
+	for (i = 0; i < count; i++) {
+		(void)client_deliver(client, &rcpts[i], session);
 		i_set_failure_prefix("lmtp(%s): ", my_pid);
-
-		client->state.rcpt_idx++;
-		if (ret == 0)
-			return TRUE;
-		/* failed. try the next one. */
 	}
-	return FALSE;
 }
 
 static void client_rcpt_fail_all(struct client *client)
@@ -815,8 +807,7 @@
 
 	session = mail_deliver_session_init();
 	old_uid = geteuid();
-	while (client_deliver_next(client, session))
-		;
+	client_deliver_mails(client, session);
 	mail_deliver_session_deinit(&session);
 
 	if (old_uid == 0) {


More information about the dovecot-cvs mailing list