]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mailbox_list_index_update_next() - Reorder code to simplify
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 28 Jan 2026 12:04:21 +0000 (14:04 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 7 May 2026 20:22:22 +0000 (20:22 +0000)
src/lib-storage/list/mailbox-list-index-iter.c

index 88e085e696e3d76b0178a983491057297b83f396..7717b4f75c966f76045bcf726e184d452bba0068 100644 (file)
@@ -144,7 +144,12 @@ mailbox_list_index_update_next(struct mailbox_list_index_iterate_context *ctx,
        } else {
                while (node->next == NULL) {
                        node = node->parent;
-                       if (node != NULL) T_BEGIN {
+                       if (node == NULL) {
+                               /* last one */
+                               ctx->next_node = NULL;
+                               return;
+                       }
+                       T_BEGIN {
                                /* The storage name kept in the iteration context
                                   is escaped. To calculate the right truncation
                                   margin, the length of the name must be
@@ -158,11 +163,6 @@ mailbox_list_index_update_next(struct mailbox_list_index_iterate_context *ctx,
                                if (node->parent != NULL)
                                        ctx->parent_len--;
                        } T_END;
-                       if (node == NULL) {
-                               /* last one */
-                               ctx->next_node = NULL;
-                               return;
-                       }
                }
                ctx->next_node = node->next;
        }