305 |
305 |
306 if (children == NULL) { |
306 if (children == NULL) { |
307 // search for the next node |
307 // search for the next node |
308 void *next; |
308 void *next; |
309 cx_tree_iter_search_next: |
309 cx_tree_iter_search_next: |
310 // check if there is a sibling |
310 // check if there is a sibling, but only if we are not a (subtree-)root |
311 if (iter->exiting) { |
311 if (iter->exiting) { |
312 next = iter->node_next; |
312 next = iter->node_next; |
313 } else { |
313 } else if (iter->depth > 1) { |
314 next = tree_next(iter->node); |
314 next = tree_next(iter->node); |
315 iter->node_next = next; |
315 iter->node_next = next; |
316 } |
316 } |
317 if (next == NULL) { |
317 if (next == NULL) { |
318 // no sibling, we are done with this node and exit |
318 // no sibling, we are done with this node and exit |