diff options
| author | Paul Eggert | 2018-07-24 15:58:46 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-07-24 16:08:09 -0700 |
| commit | 200195e824befa112459c0afbac7c94aea739573 (patch) | |
| tree | 7799fc7738ba0b7cbfa2539c4c15c713c2419cd9 /src/eval.c | |
| parent | 0ed21b7b3e71303d7858192246012f4b26438ad8 (diff) | |
| download | emacs-200195e824befa112459c0afbac7c94aea739573.tar.gz emacs-200195e824befa112459c0afbac7c94aea739573.zip | |
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.c | 20 |
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 | |||
| 1732 | } | 1732 | } |
| 1733 | 1733 | ||
| 1734 | /* Signal `error' with message S, and additional arg ARG. | 1734 | /* Signal `error' with message S, and additional arg ARG. |
| 1735 | If ARG is not a genuine list, make it a one-element list. */ | 1735 | If ARG is not a proper list, make it a one-element list. */ |
| 1736 | 1736 | ||
| 1737 | void | 1737 | void |
| 1738 | signal_error (const char *s, Lisp_Object arg) | 1738 | signal_error (const char *s, Lisp_Object arg) |
| 1739 | { | 1739 | { |
| 1740 | Lisp_Object tortoise, hare; | 1740 | if (NILP (Fproper_list_p (arg))) |
| 1741 | |||
| 1742 | hare = tortoise = arg; | ||
| 1743 | while (CONSP (hare)) | ||
| 1744 | { | ||
| 1745 | hare = XCDR (hare); | ||
| 1746 | if (!CONSP (hare)) | ||
| 1747 | break; | ||
| 1748 | |||
| 1749 | hare = XCDR (hare); | ||
| 1750 | tortoise = XCDR (tortoise); | ||
| 1751 | |||
| 1752 | if (EQ (hare, tortoise)) | ||
| 1753 | break; | ||
| 1754 | } | ||
| 1755 | |||
| 1756 | if (!NILP (hare)) | ||
| 1757 | arg = list1 (arg); | 1741 | arg = list1 (arg); |
| 1758 | 1742 | ||
| 1759 | xsignal (Qerror, Fcons (build_string (s), arg)); | 1743 | xsignal (Qerror, Fcons (build_string (s), arg)); |