]> git.eshelyaron.com Git - emacs.git/commit
itree.c: Add new "stateless" iterator code and post-order traversal
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 17 Nov 2022 14:08:24 +0000 (09:08 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 17 Nov 2022 14:08:24 +0000 (09:08 -0500)
commit13003105a8edf746a8e8819122bd1bcdf7f9ecdd
tree127f1973a5c76e109c61545bfbb3b9ecf2175126
parent7781121c44736a9a5ad0422955f23bfc045f5504
itree.c: Add new "stateless" iterator code and post-order traversal

This still uses the old iterator code, but runs the new code
alongside to make sure they behave identically.

* src/itree.c (struct itree_iterator): New field `node`.
(itree_iterator_create): Give it a sane default value.
(itree_iterator_busy_p, itree_iterator_start, itree_iterator_finish):
Move down to the "iterator" section of the file.
(itree_iter_next_in_subtree, itree_iterator_first_node)
(itree_iter_next): New functions.
(itree_iterator_start): Initialize the new `node` field.
(itree_iterator_next): Add post-order case.
Call the new "stateless" `itree_iter_next` function and check that it
agrees.

* src/itree.h (enum itree_order): New value for post-order traversals.
src/itree.c
src/itree.h