]> git.eshelyaron.com Git - emacs.git/commit
itree: Remove the `visited` flag from the tree nodes
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 29 Sep 2022 21:12:21 +0000 (17:12 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 29 Sep 2022 21:12:21 +0000 (17:12 -0400)
commita7ad0f806c1ed82f4d0710111aa92417e04a1110
treee2b7dda450178bda58d1649eb5d986b206f91e16
parent757c116f6b0bc2d8e81aef18f8eada27ca8745a1
itree: Remove the `visited` flag from the tree nodes

These bits really belong in the "workstack" used within
`interval_generator_next`, so move them there.

* src/itree.c (nodeptr_and_flag): New type;
(struct interval_stack): Use it.
(make_nav, nav_nodeptr, nav_flag): New functions.
(interval_tree_insert_gap, interval_tree_delete_gap): Adjust accordingly.
(interval_generator_next): Stash the `visited` bit in the work stack
rather than inside the tree nodes.
(interval_stack_create, interval_stack_destroy, interval_stack_clear)
(interval_stack_ensure_space, interval_stack_push_flagged)
(interval_stack_push, interval_stack_pop): Move before first use.

* src/itree.h (struct interval_node): Remove `visited` field.
* src/pdumper.c (dump_interval_node): Adjust accordingly.
src/itree.c
src/itree.h
src/pdumper.c