Simplify tree walker.
This commit is contained in:
parent
dafe9a6208
commit
1726304d72
|
@ -573,34 +573,24 @@ static bool treeview_walk_internal(struct treeview_node *root, bool full,
|
|||
node->children : NULL;
|
||||
|
||||
if (next != NULL) {
|
||||
/* down to children */
|
||||
/* Down to children */
|
||||
node = next;
|
||||
inset += tree_g.step_width;
|
||||
} else {
|
||||
/* no children */
|
||||
next = node->sibling_next;
|
||||
/* No children. As long as we're not at the root,
|
||||
* go to next sibling if present, or nearest ancestor
|
||||
* with a next sibling. */
|
||||
|
||||
if (next != NULL && node != root) {
|
||||
/* on to next sibling */
|
||||
node = next;
|
||||
} else {
|
||||
/* no next sibling */
|
||||
while (node != root) {
|
||||
next = node->sibling_next;
|
||||
|
||||
if (next != NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
node = node->parent;
|
||||
inset -= tree_g.step_width;
|
||||
}
|
||||
|
||||
if (node == root)
|
||||
break;
|
||||
|
||||
node = node->sibling_next;
|
||||
while (node != root &&
|
||||
node->sibling_next == NULL) {
|
||||
node = node->parent;
|
||||
inset -= tree_g.step_width;
|
||||
}
|
||||
|
||||
if (node == root)
|
||||
break;
|
||||
|
||||
node = node->sibling_next;
|
||||
}
|
||||
|
||||
assert(node != NULL);
|
||||
|
|
Loading…
Reference in New Issue