From: Sergey Vinokurov Date: Fri, 14 Jan 2022 07:49:11 +0000 (+0100) Subject: Use assq_no_quit on all local_var_alist accesses X-Git-Tag: emacs-29.0.90~3073 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a5ce31a192f474bce1259b97e599258d1fde7c8c;p=emacs.git Use assq_no_quit on all local_var_alist accesses * src/data.c (Fkill_local_variable): * src/buffer.c (buffer_local_value): Use assq_no_quit instead of Fassoc/Fassq on local_var_alist (bug#53242). * src/data.c (Flocal_variable_p): Use assq_no_quit instead of open-coding the search on local_var_alist. --- diff --git a/src/buffer.c b/src/buffer.c index 10ac91915c6..a3091015d9b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1247,7 +1247,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer) { /* Look in local_var_alist. */ struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); XSETSYMBOL (variable, sym); /* Update In case of aliasing. */ - result = Fassoc (variable, BVAR (buf, local_var_alist), Qnil); + result = assq_no_quit (variable, BVAR (buf, local_var_alist)); if (!NILP (result)) { if (blv->fwd.fwdptr) diff --git a/src/data.c b/src/data.c index 5d0790692b7..f287c38fcdf 100644 --- a/src/data.c +++ b/src/data.c @@ -2103,7 +2103,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) /* Make sure this buffer has its own value of symbol. */ XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ - tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); + tem = assq_no_quit (variable, BVAR (current_buffer, local_var_alist)); if (NILP (tem)) { if (let_shadows_buffer_binding_p (sym)) @@ -2183,7 +2183,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) /* Get rid of this buffer's alist element, if any. */ XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ - tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); + tem = assq_no_quit (variable, BVAR (current_buffer, local_var_alist)); if (!NILP (tem)) bset_local_var_alist (current_buffer, @@ -2224,7 +2224,7 @@ Also see `buffer-local-boundp'.*/) case SYMBOL_PLAINVAL: return Qnil; case SYMBOL_LOCALIZED: { - Lisp_Object tail, elt, tmp; + Lisp_Object tmp; struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); XSETBUFFER (tmp, buf); XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ @@ -2232,13 +2232,9 @@ Also see `buffer-local-boundp'.*/) if (EQ (blv->where, tmp)) /* The binding is already loaded. */ return blv_found (blv) ? Qt : Qnil; else - for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) - { - elt = XCAR (tail); - if (EQ (variable, XCAR (elt))) - return Qt; - } - return Qnil; + return NILP (assq_no_quit (variable, BVAR (buf, local_var_alist))) + ? Qnil + : Qt; } case SYMBOL_FORWARDED: {