From c0a250642dc998c35e8a3d471198fb13ff5bb54f Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Mon, 17 Jan 2022 11:16:09 +0100 Subject: [PATCH] Remove unused argument to Findirect_function. Use Findirect_function more where possible. --- src/callint.c | 2 +- src/data.c | 8 +++----- src/doc.c | 2 +- src/eval.c | 36 ++++++++++-------------------------- src/keymap.c | 2 +- 5 files changed, 16 insertions(+), 34 deletions(-) diff --git a/src/callint.c b/src/callint.c index ce77c893f4..f046d53e95 100644 --- a/src/callint.c +++ b/src/callint.c @@ -327,7 +327,7 @@ DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, /* If SPECS is not a string, invent one. */ if (! STRINGP (specs)) { - Lisp_Object funval = Findirect_function (function, Qt); + Lisp_Object funval = Findirect_function (function); uintmax_t events = num_input_events; Lisp_Object input = specs; /* Compute the arg values using the user's expression. */ diff --git a/src/data.c b/src/data.c index f287c38fcd..173f0fb54f 100644 --- a/src/data.c +++ b/src/data.c @@ -2365,13 +2365,13 @@ indirect_function (register Lisp_Object object) return hare; } -DEFUN ("indirect-function", Findirect_function, Sindirect_function, 1, 2, 0, +DEFUN ("indirect-function", Findirect_function, Sindirect_function, 1, 1, 0, doc: /* Return the function at the end of OBJECT's function chain. If OBJECT is not a symbol, just return it. Otherwise, follow all function indirections to find the final function binding and return it. Signal a cyclic-function-indirection error if there is a loop in the function chain of symbols. */) - (register Lisp_Object object, Lisp_Object noerror) + (register Lisp_Object object) { Lisp_Object result; @@ -2380,10 +2380,8 @@ DEFUN ("indirect-function", Findirect_function, Sindirect_function, 1, 2, 0, if (SYMBOLP (result) && !NILP (result) && (result = XSYMBOL (result)->u.s.function, SYMBOLP (result))) result = indirect_function (result); - if (!NILP (result)) - return result; - return Qnil; + return result; } /* Extract and set vector and string elements. */ diff --git a/src/doc.c b/src/doc.c index 0b12eb154d..3c8bb19eb6 100644 --- a/src/doc.c +++ b/src/doc.c @@ -325,7 +325,7 @@ DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, raw); } - Lisp_Object fun = Findirect_function (function, Qnil); + Lisp_Object fun = Findirect_function (function); if (NILP (fun)) xsignal1 (Qvoid_function, function); if (CONSP (fun) && EQ (XCAR (fun), Qmacro)) diff --git a/src/eval.c b/src/eval.c index 5514583b6a..a8c69f43ee 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2344,7 +2344,7 @@ DEFUN ("autoload-do-load", Fautoload_do_load, Sautoload_do_load, 1, 3, 0, return Qnil; else { - Lisp_Object fun = Findirect_function (funname, Qnil); + Lisp_Object fun = Findirect_function(funname); if (!NILP (Fequal (fun, fundef))) error ("Autoloading file %s failed to define function %s", @@ -2667,15 +2667,10 @@ DEFUN ("apply", Fapply, Sapply, 1, MANY, 0, numargs += nargs - 2; - /* Optimize for no indirection. */ - if (SYMBOLP (fun) && !NILP (fun) - && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun))) - { - fun = indirect_function (fun); - if (NILP (fun)) - /* Let funcall get the error. */ - fun = args[0]; - } + fun = Findirect_function(fun); + if (NILP (fun)) + /* Let funcall get the error. */ + fun = args[0]; if (SUBRP (fun) && XSUBR (fun)->max_args > numargs /* Don't hide an error by adding missing arguments. */ @@ -3008,7 +3003,7 @@ FUNCTIONP (Lisp_Object object) { if (SYMBOLP (object) && !NILP (Ffboundp (object))) { - object = Findirect_function (object, Qt); + object = Findirect_function(object); if (CONSP (object) && EQ (XCAR (object), Qautoload)) { @@ -3068,11 +3063,7 @@ DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, retry: - /* Optimize for no indirection. */ - fun = original_fun; - if (SYMBOLP (fun) && !NILP (fun) - && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun))) - fun = indirect_function (fun); + fun = Findirect_function(original_fun); if (SUBRP (fun) && !SUBR_NATIVE_COMPILED_DYNP (fun)) val = funcall_subr (XSUBR (fun), numargs, args + 1); @@ -3387,14 +3378,7 @@ DEFUN ("func-arity", Ffunc_arity, Sfunc_arity, 1, 1, 0, retry: - /* Optimize for no indirection. */ - function = original; - if (SYMBOLP (function) && !NILP (function)) - { - function = XSYMBOL (function)->u.s.function; - if (SYMBOLP (function)) - function = indirect_function (function); - } + function = Findirect_function(original); if (CONSP (function) && EQ (XCAR (function), Qmacro)) function = XCDR (function); @@ -3936,9 +3920,9 @@ get_backtrace_starting_at (Lisp_Object base) if (!NILP (base)) { /* Skip up to `base'. */ - base = Findirect_function (base, Qt); + base = Findirect_function(base); while (backtrace_p (pdl) - && !EQ (base, Findirect_function (backtrace_function (pdl), Qt))) + && !EQ (base, Findirect_function(backtrace_function (pdl)))) pdl = backtrace_next (pdl); } diff --git a/src/keymap.c b/src/keymap.c index ed69b1c427..7be0e3c155 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1614,7 +1614,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr) } /* Get the keymap definition--or nil if it is not defined. */ - temp = Findirect_function (XCDR (assoc), Qt); + temp = Findirect_function(XCDR (assoc)); if (!NILP (temp)) { cmm_modes[i] = var; -- 2.34.1