[dovecot-cvs] dovecot/src/imap imap-thread.c,1.20,1.20.2.1
tss-movial at dovecot.org
tss-movial at dovecot.org
Mon Jun 19 17:16:05 EEST 2006
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv18834
Modified Files:
Tag: branch_1_0
imap-thread.c
Log Message:
Optimization for checking loops.
Index: imap-thread.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-thread.c,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -u -d -r1.20 -r1.20.2.1
--- imap-thread.c 14 Jan 2006 18:47:21 -0000 1.20
+++ imap-thread.c 19 Jun 2006 14:16:02 -0000 1.20.2.1
@@ -360,20 +360,13 @@
add_root(ctx, child);
}
-static bool find_child(struct node *node, struct node *child)
+static bool find_parent(struct node *node, struct node *parent)
{
- do {
- if (node == child)
+ while (node != NULL) {
+ if (node == parent)
return TRUE;
-
- if (node->first_child != NULL) {
- if (find_child(node->first_child, child))
- return TRUE;
- }
-
- node = node->next;
- } while (node != NULL);
-
+ node = node->parent;
+ }
return FALSE;
}
@@ -396,7 +389,7 @@
return;
}
- if (find_child(child, parent)) {
+ if (find_parent(parent, child)) {
/* this would create a loop, not allowed */
return;
}
More information about the dovecot-cvs
mailing list