diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-30 20:37:15 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-30 20:37:15 -0400 |
commit | ab2926aad3e15c6cfa0e4b31ae9274c47a58baf2 (patch) | |
tree | e1d202146ef6c9cfaabf38fe878b875a55627cd3 /src/buffer.c | |
parent | 009249e0c6d3bb6c4a3714a279ae91807d133c77 (diff) | |
download | emacs-ab2926aad3e15c6cfa0e4b31ae9274c47a58baf2.tar.gz emacs-ab2926aad3e15c6cfa0e4b31ae9274c47a58baf2.tar.bz2 emacs-ab2926aad3e15c6cfa0e4b31ae9274c47a58baf2.zip |
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`.
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 2f026584bbf..19937216ed5 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -921,6 +921,14 @@ delete_all_overlays (struct buffer *b) if (! b->overlays) return; + /* FIXME: This loop sets the overlays' `buffer` field to NULL but + doesn't set the interval_nodes' `parent`, `left` and `right` + fields accordingly. I believe it's harmless, but a bit untidy since + other parts of the code are careful to set those fields to NULL when + the overlay is deleted. + Of course, we can't set them to NULL from within the iteration + because the iterator may need them (tho we could if we added + an ITREE_POST_ORDER iteration order). */ buffer_overlay_iter_start (b, PTRDIFF_MIN, PTRDIFF_MAX, ITREE_ASCENDING); while ((node = buffer_overlay_iter_next (b))) { |