aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorStefan Monnier2022-11-17 17:00:22 -0500
committerStefan Monnier2022-11-17 17:00:22 -0500
commitfb7f1864da4aa4c09756cfe47db6c56b4e87bd14 (patch)
tree4ccd8ca7e29c5609fa437884c739106a4f1b2cc2 /src/eval.c
parent13003105a8edf746a8e8819122bd1bcdf7f9ecdd (diff)
downloademacs-fb7f1864da4aa4c09756cfe47db6c56b4e87bd14.tar.gz
emacs-fb7f1864da4aa4c09756cfe47db6c56b4e87bd14.zip
itree.c: Make the iterator reentrant (bug#59183)
Get rid of the global iterator object and instead allocate a separate iterator for every loop. This still uses the "duplicate iterator" code, including the old iterator which needs a stack, make ITREE_FOREACH a bit more expensive than we'd like. * src/itree.h (init_itree, forget_itree, itree_iterator_busy_p): Delete declarations. (itree_iterator_start): Add iterator arg and remove `line` and `file` args. (struct itree_iterator): Move from `itree.c`. Remove `line` and `file` fields. (ITREE_FOREACH): Stack allocate an iterator object and pass it to `itree_iterator_start`. * src/itree.c (struct itree_iterator): Move to itree.h. (iter): Delete global variable. (itree_iterator_create, init_itree, forget_itree, itree_iterator_busy_p): Delete functions. (itree_contains): Adjust assertion. (itree_iterator_finish): Deallocate the iterator's stack. (itree_iterator_start): Take the (uninitialized) iterator as argument. Allocate a fresh new stack. Remove `file` and `line` arguments. Don't check `running` any more since the iterator is not expected to be initialized at all. * src/eval.c (signal_or_quit): * src/alloc.c (garbage_collect): Don't check `itree_iterator_busy_p` any more. * src/emacs.c (main): No need to `init_itree` any more. (Fdump_emacs): No need to `forget_itree` any more.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index ea238299488..78e606267f6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1716,7 +1716,6 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit)
1716 Lisp_Object clause = Qnil; 1716 Lisp_Object clause = Qnil;
1717 struct handler *h; 1717 struct handler *h;
1718 1718
1719 eassert (!itree_iterator_busy_p ());
1720 if (gc_in_progress || waiting_for_input) 1719 if (gc_in_progress || waiting_for_input)
1721 emacs_abort (); 1720 emacs_abort ();
1722 1721