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.
This commit is contained in:
Sergey Vinokurov 2022-01-14 08:49:11 +01:00 committed by Lars Ingebrigtsen
parent 3ae74c2e47
commit a5ce31a192
2 changed files with 7 additions and 11 deletions

View file

@ -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)

View file

@ -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:
{