]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: client: Dropped useless rcpt_idx state.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 19 Sep 2017 00:07:22 +0000 (02:07 +0200)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 7 Dec 2017 23:08:15 +0000 (00:08 +0100)
Recent refactoring made it obsolete.

src/lmtp/client.h
src/lmtp/lmtp-local.c

index 37eb5ff35f06d0e07f60f0e6dc5d68174d0a1f48..1c120f7b322789953fbdad2059d8275999be84f4 100644 (file)
@@ -25,7 +25,6 @@ struct client_state {
        struct smtp_address *mail_from;
        struct smtp_params_mail mail_params;
        ARRAY(struct lmtp_recipient *) rcpt_to;
-       unsigned int rcpt_idx;
 
        unsigned int data_end_idx;
 
index c0ce1db01e0f0b588e0b28398106855b4c3bfc69..2848d53cf53f17b722170f96eb2f1916fbdd22c5 100644 (file)
@@ -439,38 +439,32 @@ lmtp_local_deliver(struct client *client,
        return ret;
 }
 
-static bool client_rcpt_to_is_last(struct client *client)
-{
-       return client->state.rcpt_idx >= array_count(&client->state.rcpt_to);
-}
-
 static uid_t client_deliver_to_rcpts(struct client *client,
                                     struct mail_deliver_session *session)
 {
        uid_t first_uid = (uid_t)-1;
        struct mail *src_mail;
-
        struct lmtp_recipient *const *rcpts;
-       unsigned int count;
+       unsigned int count, i;
        int ret;
        src_mail = client->state.raw_mail;
 
        rcpts = array_get(&client->state.rcpt_to, &count);
-       while (client->state.rcpt_idx < count) {
-               ret = lmtp_local_deliver(client, rcpts[client->state.rcpt_idx],
+       for (i = 0; i < count; i++) {
+               struct lmtp_recipient *rcpt = rcpts[i];
+
+               ret = lmtp_local_deliver(client, rcpt,
                                     src_mail, session);
                client_state_set(client, "DATA", "");
                i_set_failure_prefix("lmtp(%s): ", my_pid);
 
-               client->state.rcpt_idx++;
-
                /* succeeded and mail_user is not saved in first_saved_mail */
                if ((ret == 0 &&
                     (client->state.first_saved_mail == NULL ||
                      client->state.first_saved_mail == src_mail)) ||
                    /* failed. try the next one. */
                    (ret != 0 && client->state.dest_user != NULL)) {
-                       if (client_rcpt_to_is_last(client))
+                       if (i == (count - 1))
                                mail_user_autoexpunge(client->state.dest_user);
                        mail_user_unref(&client->state.dest_user);
                } else if (ret == 0) {