]> git.eshelyaron.com Git - emacs.git/commit
itree.c: Improve division between tree and iterator
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 1 Oct 2022 00:37:15 +0000 (20:37 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 1 Oct 2022 00:37:15 +0000 (20:37 -0400)
commitab2926aad3e15c6cfa0e4b31ae9274c47a58baf2
treee1d202146ef6c9cfaabf38fe878b875a55627cd3
parent009249e0c6d3bb6c4a3714a279ae91807d133c77
itree.c: Improve division between tree and iterator

* src/buffer.c (delete_all_overlays): Add comment.

* src/itree.c (struct interval_generator): New fields `running`,
`file`, and `line` moved from `interval_tree`.
(interval_stack_push_flagged): Adjust comment to resolve a FIXME.
(interval_tree_clear): Replace assignment with an a
(interval_tree_iter_next): Delete function.
(interval_tree_clear): Don't set `iter_running` here any more.
(interval_generator_create): Set it here instead.
(interval_tree_iter_start): Fetch `iter` once and for all.
(interval_generator_narrow): Mark it as non-static.
(interval_tree_iter_next, interval_tree_iter_narrow):
Delete functions.  Inline their old bodies in the callers.
(interval_tree_iter_finish): Take the iter rather than
the whole tree.  Adjust all callers.
(interval_generator_next): Move `running `assertion here from
`interval_tree_iter_next`.

* src/buffer.h: Adjust accordingly.

* src/itree.h (struct interval_tree): Remove fields `iter_running`,
`file`, and `line`, moved to `interval_generator`.
(interval_generator_narrow): Replace `interval_tree_iter_narrow`.
src/buffer.c
src/buffer.h
src/itree.c
src/itree.h