summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-07-24 15:58:46 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-07-24 16:08:09 -0700
commit200195e824befa112459c0afbac7c94aea739573 (patch)
tree7799fc7738ba0b7cbfa2539c4c15c713c2419cd9 /src/eval.c
parent0ed21b7b3e71303d7858192246012f4b26438ad8 (diff)
downloademacs-200195e824befa112459c0afbac7c94aea739573.tar.gz
Move proper-list-p to C
Since C code can use it and it’s simple, we might as well use C. * lisp/subr.el (proper-list-p): Move to C code. * src/eval.c (signal_error): Simplify by using Fproper_list_p. * src/fns.c (Fproper_list_p): New function, moved here from Lisp. Simplify signal_error * src/eval.c (signal_error): Simplify by using FOR_EACH_TAIL_SAFE.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/eval.c b/src/eval.c
index 256ca8ffdc8..5964dd1867a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1732,28 +1732,12 @@ xsignal3 (Lisp_Object error_symbol, Lisp_Object arg1, Lisp_Object arg2, Lisp_Obj
}
/* Signal `error' with message S, and additional arg ARG.
- If ARG is not a genuine list, make it a one-element list. */
+ If ARG is not a proper list, make it a one-element list. */
void
signal_error (const char *s, Lisp_Object arg)
{
- Lisp_Object tortoise, hare;
-
- hare = tortoise = arg;
- while (CONSP (hare))
- {
- hare = XCDR (hare);
- if (!CONSP (hare))
- break;
-
- hare = XCDR (hare);
- tortoise = XCDR (tortoise);
-
- if (EQ (hare, tortoise))
- break;
- }
-
- if (!NILP (hare))
+ if (NILP (Fproper_list_p (arg)))
arg = list1 (arg);
xsignal (Qerror, Fcons (build_string (s), arg));