diff options
| author | Stefan Monnier | 2022-11-17 18:09:37 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2022-11-17 18:09:37 -0500 |
| commit | 091e0f04ffe494ee4cddb67670f0c495a7c9b691 (patch) | |
| tree | 3e93d67eed88aeea94cc78951e987fedffd7d8ea /src/buffer.c | |
| parent | fb7f1864da4aa4c09756cfe47db6c56b4e87bd14 (diff) | |
| download | emacs-scratch/noverlay.tar.gz emacs-scratch/noverlay.zip | |
itree.c: Get rid of the old iterator codescratch/noverlay
Only use the new iterator which relies on a fixed size (and small)
state in the iterator.
This makes non-local exits safe within ITREE_FOREACH loops.
* src/itree.c (make_nav, nav_nodeptr, nav_flag, itree_stack_clear)
(itree_stack_push_flagged): Delete functions.
(nodeptr_and_flag): Delete type.
(struct itree_stack): Make the array hold plain pointers instead.
(itree_stack_push): Inline the former code of `itree_stack_push_flagged`.
(itree_stack_pop): Change return type.
(itree_contains): Don't call `ITREE_FOREACH_ABORT` any more.
(itree_insert_gap): Simplify access to the stack of nodes.
(itree_delete_gap, itree_insert_gap): Adjust code to new return type of
`itree_stack_pop`.
(itree_iterator_finish): Delete function.
(itree_iterator_start): Don't setup the `stack` field any more.
(itree_iterator_next): Delete function.
(itree_iter_next): Rename to `itree_iterator_next` and make it non-static.
(itree_iterator_narrow): Don't check the `running` flag any more.
* src/itree.h (itree_iterator_finish): Remove declaration.
(struct itree_iterator): Remove the `stack` and `running` fields.
(ITREE_FOREACH_ABORT): Delete macro.
(ITREE_FOREACH): Don't call `itree_iterator_finish` any more.
* src/xdisp.c (strings_with_newlines):
* src/buffer.c (overlays_in, next_overlay_change, overlay_touches_p):
Don't call `ITREE_FOREACH_ABORT` any more.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/buffer.c b/src/buffer.c index 9be2c4a970e..4da5b451d0f 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2985,17 +2985,13 @@ overlays_in (ptrdiff_t beg, ptrdiff_t end, bool extend, | |||
| 2985 | if (node->begin > end) | 2985 | if (node->begin > end) |
| 2986 | { | 2986 | { |
| 2987 | next = min (next, node->begin); | 2987 | next = min (next, node->begin); |
| 2988 | ITREE_FOREACH_ABORT (); | ||
| 2989 | break; | 2988 | break; |
| 2990 | } | 2989 | } |
| 2991 | else if (node->begin == end) | 2990 | else if (node->begin == end) |
| 2992 | { | 2991 | { |
| 2993 | next = node->begin; | 2992 | next = node->begin; |
| 2994 | if ((! empty || end < ZV) && beg < end) | 2993 | if ((! empty || end < ZV) && beg < end) |
| 2995 | { | 2994 | break; |
| 2996 | ITREE_FOREACH_ABORT (); | ||
| 2997 | break; | ||
| 2998 | } | ||
| 2999 | if (empty && node->begin != node->end) | 2995 | if (empty && node->begin != node->end) |
| 3000 | continue; | 2996 | continue; |
| 3001 | } | 2997 | } |
| @@ -3050,7 +3046,6 @@ next_overlay_change (ptrdiff_t pos) | |||
| 3050 | of pos, because the search is limited to [pos,next) . */ | 3046 | of pos, because the search is limited to [pos,next) . */ |
| 3051 | eassert (node->begin < next); | 3047 | eassert (node->begin < next); |
| 3052 | next = node->begin; | 3048 | next = node->begin; |
| 3053 | ITREE_FOREACH_ABORT (); | ||
| 3054 | break; | 3049 | break; |
| 3055 | } | 3050 | } |
| 3056 | else if (node->begin < node->end && node->end < next) | 3051 | else if (node->begin < node->end && node->end < next) |
| @@ -3155,10 +3150,7 @@ overlay_touches_p (ptrdiff_t pos) | |||
| 3155 | pos. */ | 3150 | pos. */ |
| 3156 | ITREE_FOREACH (node, current_buffer->overlays, pos - 1, pos + 1, DESCENDING) | 3151 | ITREE_FOREACH (node, current_buffer->overlays, pos - 1, pos + 1, DESCENDING) |
| 3157 | if (node->begin == pos || node->end == pos) | 3152 | if (node->begin == pos || node->end == pos) |
| 3158 | { | 3153 | return true; |
| 3159 | ITREE_FOREACH_ABORT (); | ||
| 3160 | return true; | ||
| 3161 | } | ||
| 3162 | return false; | 3154 | return false; |
| 3163 | } | 3155 | } |
| 3164 | 3156 | ||