]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Avoid wasting data stack on larger renames.
authorTimo Sirainen <tss@iki.fi>
Thu, 13 Jun 2013 21:16:14 +0000 (00:16 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 13 Jun 2013 21:16:14 +0000 (00:16 +0300)
src/doveadm/dsync/dsync-mailbox-tree-sync.c

index 2d3895dd04e22c7d9cd004fda6a9d5ddb17a9d9a..ac9cbacc5fb08075f979ad391816def46d7e66cb 100644 (file)
@@ -717,6 +717,7 @@ static bool sync_rename_mailboxes(struct dsync_mailbox_tree_sync_ctx *ctx,
        struct dsync_mailbox_node **local_nodep = &local_parent->first_child;
        struct dsync_mailbox_node **remote_nodep = &remote_parent->first_child;
        struct dsync_mailbox_node *local_node, *remote_node;
+       bool changed;
 
        /* the nodes are sorted by their names. */
        while (*local_nodep != NULL || *remote_nodep != NULL) {
@@ -750,11 +751,19 @@ static bool sync_rename_mailboxes(struct dsync_mailbox_tree_sync_ctx *ctx,
                        /* mailboxes are equal, no need to rename */
                } else {
                        /* mailbox naming conflict */
-                       if (sync_rename_conflict(ctx, local_node, remote_node))
+                       T_BEGIN {
+                               changed = sync_rename_conflict(ctx, local_node,
+                                                              remote_node);
+                       } T_END;
+                       if (changed)
                                return TRUE;
                }
                /* handle children, if there are any */
-               if (sync_rename_mailboxes(ctx, local_node, remote_node))
+               T_BEGIN {
+                       changed = sync_rename_mailboxes(ctx, local_node,
+                                                       remote_node);
+               } T_END;
+               if (changed)
                        return TRUE;
 
                local_nodep = &local_node->next;