]> git.eshelyaron.com Git - emacs.git/commitdiff
Use calln instead of calling Ffuncall directly
authorStefan Kangas <stefankangas@gmail.com>
Tue, 14 Jan 2025 20:36:46 +0000 (21:36 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 17 Jan 2025 11:34:49 +0000 (12:34 +0100)
* src/bytecode.c (bcall0):
* src/comp.c (bcall0):
* src/eval.c (apply1):
* src/lisp.h (call0):
* src/thread.c (invoke_thread_function): Use calln instead of calling
Ffuncall directly.

* admin/coccinelle/calln.cocci: New semantic patch.

(cherry picked from commit 16c89c5ae5ec0c002c327793e783f0a943bacb0d)

admin/coccinelle/calln.cocci [new file with mode: 0644]
src/bytecode.c
src/comp.c
src/eval.c
src/lisp.h
src/thread.c

diff --git a/admin/coccinelle/calln.cocci b/admin/coccinelle/calln.cocci
new file mode 100644 (file)
index 0000000..5e72093
--- /dev/null
@@ -0,0 +1,21 @@
+// Use the calln macro where possible.
+@@
+@@
+- CALLN ( Ffuncall,
++ calln (
+  ...)
+
+@@
+constant c;
+expression e;
+@@
+- Ffuncall ( c, &e )
++ calln ( e )
+
+@@
+constant c;
+expression e;
+@@
+- Ffuncall ( c, &e,
++ calln ( e,
+  ...)
index fcf369400b9f2939cd79f8d46dd551a5a41aac15..d62d7d067b137fe3323535294db5d75249407453 100644 (file)
@@ -327,7 +327,7 @@ If the third argument is incorrect, Emacs may crash.  */)
 static void
 bcall0 (Lisp_Object f)
 {
-  Ffuncall (1, &f);
+  calln (f);
 }
 
 /* The bytecode stack size in bytes.
index 96b314b27098a9b78f62c5ea61c8f52e75736488..97c7ea2efac226867ec8bbf7146605b287c59607 100644 (file)
@@ -862,7 +862,7 @@ freloc_check_fill (void)
 static void
 bcall0 (Lisp_Object f)
 {
-  Ffuncall (1, &f);
+  calln (f);
 }
 
 static gcc_jit_block *
index b0cc2505a35497be657ca2e2f617d5e35db9f16d..941d121c2fb88840f9c97d23b0a9a87b3b04b906 100644 (file)
@@ -2967,7 +2967,7 @@ run_hook_with_args_2 (Lisp_Object hook, Lisp_Object arg1, Lisp_Object arg2)
 Lisp_Object
 apply1 (Lisp_Object fn, Lisp_Object arg)
 {
-  return NILP (arg) ? Ffuncall (1, &fn) : CALLN (Fapply, fn, arg);
+  return NILP (arg) ? calln (fn) : CALLN (Fapply, fn, arg);
 }
 
 DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
index e3142f3b8cc799c81234fa8c17d28f2b403ec63b..a8fe2e9f6bc3540f2201cd33eb2dfbab7fe90a86 100644 (file)
@@ -3528,7 +3528,7 @@ enum maxargs
 INLINE Lisp_Object
 call0 (Lisp_Object fn)
 {
-  return Ffuncall (1, &fn);
+  return calln (fn);
 }
 
 extern void defvar_lisp (struct Lisp_Objfwd const *, char const *);
index bb62283dd21407140fdb129b032123a44ff5e29c..5610f8be0dd094d4bbfb09bf6eaf4bc979ac6b0c 100644 (file)
@@ -741,7 +741,7 @@ invoke_thread_function (void)
 {
   specpdl_ref count = SPECPDL_INDEX ();
 
-  current_thread->result = Ffuncall (1, &current_thread->function);
+  current_thread->result = calln (current_thread->function);
   return unbind_to (count, Qnil);
 }