Mercurial > hg > xemacs-beta
diff src/fns.c @ 5299:28651c24b3f8
Error in #'list-length if LIST is dotted; check for this error with #'mapcar
src/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea@parhasard.net>
* fns.c (Flist_length): Error if LIST is dotted in this function;
document this behaviour.
tests/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el (malformed-list): Check that #'mapcar,
#'map and #'list-length throw this error when appropriate.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 06 Nov 2010 14:51:13 +0000 |
parents | 99de5fd48e87 |
children | 9f738305f80f |
line wrap: on
line diff
--- a/src/fns.c Tue Nov 02 20:19:39 2010 +0100 +++ b/src/fns.c Sat Nov 06 14:51:13 2010 +0000 @@ -345,6 +345,7 @@ DEFUN ("list-length", Flist_length, 1, 1, 0, /* Return the length of LIST. Return nil if LIST is circular. +Error if LIST is dotted. */ (list)) { @@ -359,6 +360,11 @@ tortoise = XCDR (tortoise); } + if (!LISTP (hare)) + { + signal_malformed_list_error (list); + } + return EQ (hare, tortoise) && len != 0 ? Qnil : make_int (len); }