From b8e7be28336ea02e899fbf4a67780e0528327d1a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 22 Apr 2019 12:34:26 -0700 Subject: [PATCH] Tweak Vinternal_interpreter_environment lookup * src/eval.c (Fsetq, eval_sub): Use assq_no_quit instead of Fassq for a list that cannot contain cycles or be that long. --- src/eval.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/eval.c b/src/eval.c index 4693767ce7e..fde63f1a21c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -501,7 +501,7 @@ usage: (setq [SYM VAL]...) */) for (EMACS_INT nargs = 0; CONSP (tail); nargs += 2) { - Lisp_Object sym = XCAR (tail), lex_binding; + Lisp_Object sym = XCAR (tail); tail = XCDR (tail); if (!CONSP (tail)) xsignal2 (Qwrong_number_of_arguments, Qsetq, make_fixnum (nargs + 1)); @@ -510,10 +510,12 @@ usage: (setq [SYM VAL]...) */) val = eval_sub (arg); /* Like for eval_sub, we do not check declared_special here since it's been done when let-binding. */ - if (!NILP (Vinternal_interpreter_environment) /* Mere optimization! */ - && SYMBOLP (sym) - && !NILP (lex_binding - = Fassq (sym, Vinternal_interpreter_environment))) + Lisp_Object lex_binding + = ((!NILP (Vinternal_interpreter_environment) /* Mere optimization! */ + && SYMBOLP (sym)) + ? assq_no_quit (sym, Vinternal_interpreter_environment) + : Qnil); + if (!NILP (lex_binding)) XSETCDR (lex_binding, val); /* SYM is lexically bound. */ else Fset (sym, val); /* SYM is dynamically bound. */ @@ -2159,9 +2161,9 @@ eval_sub (Lisp_Object form) We do not pay attention to the declared_special flag here, since we already did that when let-binding the variable. */ Lisp_Object lex_binding - = !NILP (Vinternal_interpreter_environment) /* Mere optimization! */ - ? Fassq (form, Vinternal_interpreter_environment) - : Qnil; + = (!NILP (Vinternal_interpreter_environment) /* Mere optimization! */ + ? assq_no_quit (form, Vinternal_interpreter_environment) + : Qnil); return !NILP (lex_binding) ? XCDR (lex_binding) : Fsymbol_value (form); } -- 2.39.2