# HG changeset patch # User Mike Becker # Date 1745751365 -7200 # Node ID b240b73d2a10062655e29b792d3bdf22a1d3bdf8 # Parent ce01b482daa3c6946ff848a7399267dc1e5d209f fix that iteration continued with siblings for a subtree-root - fixes #656 diff -r ce01b482daa3 -r b240b73d2a10 CHANGELOG --- a/CHANGELOG Sun Apr 27 12:54:16 2025 +0200 +++ b/CHANGELOG Sun Apr 27 12:56:05 2025 +0200 @@ -12,6 +12,7 @@ * changes grow strategy for CxBuffer, which does now take the page size into account * changes the implementation of cx_strreplacen() for improved efficiency * changes all cxListIterator() without index to also accept NULL as list argument + * fixes that starting an iteration in a non-root node incorrectly continues iteration with the siblings of that node * fixes unnecessary allocations in cx_strcat() family of functions * fixes errno value after failing cxBufferSeek() to be consistently EINVAL * fixes implementation of cxBufferTerminate() diff -r ce01b482daa3 -r b240b73d2a10 docs/Writerside/topics/about.md --- a/docs/Writerside/topics/about.md Sun Apr 27 12:54:16 2025 +0200 +++ b/docs/Writerside/topics/about.md Sun Apr 27 12:56:05 2025 +0200 @@ -39,6 +39,7 @@ * changes grow strategy for CxBuffer, which does now take the page size into account * changes the implementation of cx_strreplacen() for improved efficiency * changes all cxListIterator() without index to also accept NULL as list argument +* fixes that starting an iteration in a non-root node incorrectly continues iteration with the siblings of that node * fixes unnecessary allocations in cx_strcat() family of functions * fixes errno value after failing cxBufferSeek() to be consistently EINVAL * fixes implementation of cxBufferTerminate() diff -r ce01b482daa3 -r b240b73d2a10 src/tree.c --- a/src/tree.c Sun Apr 27 12:54:16 2025 +0200 +++ b/src/tree.c Sun Apr 27 12:56:05 2025 +0200 @@ -307,10 +307,10 @@ // search for the next node void *next; cx_tree_iter_search_next: - // check if there is a sibling + // check if there is a sibling, but only if we are not a (subtree-)root if (iter->exiting) { next = iter->node_next; - } else { + } else if (iter->depth > 1) { next = tree_next(iter->node); iter->node_next = next; }