summaryrefslogtreecommitdiffstats
path: root/src/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/tree.c b/src/tree.c
index ece8594..c3e2323 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -254,16 +254,17 @@ static gboolean
foreach_up(MqTree *node, gboolean (*cb)(MqTree *node, gpointer user_data),
gpointer user_data)
{
- if (node->next) {
- if (foreach_down(node->next, cb, user_data) == MQ_TREE_STOP) {
- return MQ_TREE_STOP;
- }
+ node = node->parent;
+ if (!node) {
+ return MQ_TREE_CONTINUE;
}
- if (node->parent) {
- if (foreach_up(node->parent, cb, user_data) == MQ_TREE_STOP) {
- return MQ_TREE_STOP;
- }
+ if (foreach_down(node->next, cb, user_data) == MQ_TREE_STOP) {
+ return MQ_TREE_STOP;
+ }
+
+ if (foreach_up(node, cb, user_data) == MQ_TREE_STOP) {
+ return MQ_TREE_STOP;
}
return MQ_TREE_CONTINUE;