[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 16c89c5ae5e: Use calln instead of calling Ffuncall directly
From: |
Stefan Kangas |
Subject: |
master 16c89c5ae5e: Use calln instead of calling Ffuncall directly |
Date: |
Tue, 14 Jan 2025 15:37:24 -0500 (EST) |
branch: master
commit 16c89c5ae5ec0c002c327793e783f0a943bacb0d
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
Use calln instead of calling Ffuncall directly
* 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.
---
admin/coccinelle/calln.cocci | 21 +++++++++++++++++++++
src/bytecode.c | 2 +-
src/comp.c | 2 +-
src/eval.c | 2 +-
src/lisp.h | 2 +-
src/thread.c | 2 +-
6 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/admin/coccinelle/calln.cocci b/admin/coccinelle/calln.cocci
new file mode 100644
index 00000000000..5e720931fb5
--- /dev/null
+++ b/admin/coccinelle/calln.cocci
@@ -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,
+ ...)
diff --git a/src/bytecode.c b/src/bytecode.c
index fcf369400b9..d62d7d067b1 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -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.
diff --git a/src/comp.c b/src/comp.c
index 96b314b2709..97c7ea2efac 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -862,7 +862,7 @@ freloc_check_fill (void)
static void
bcall0 (Lisp_Object f)
{
- Ffuncall (1, &f);
+ calln (f);
}
static gcc_jit_block *
diff --git a/src/eval.c b/src/eval.c
index b0cc2505a35..941d121c2fb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -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,
diff --git a/src/lisp.h b/src/lisp.h
index e3142f3b8cc..a8fe2e9f6bc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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 *);
diff --git a/src/thread.c b/src/thread.c
index bb62283dd21..5610f8be0dd 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -741,7 +741,7 @@ invoke_thread_function (void)
{
specpdl_ref count = SPECPDL_INDEX ();
- current_thread->result = Ffuncall (1, ¤t_thread->function);
+ current_thread->result = calln (current_thread->function);
return unbind_to (count, Qnil);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 16c89c5ae5e: Use calln instead of calling Ffuncall directly,
Stefan Kangas <=