changeset 110971:80846b446563

lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206).
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 14 Oct 2010 01:15:03 +0200
parents 029adaffe445
children dff76f22a051
files lisp/ChangeLog lisp/subr.el
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Oct 13 23:12:47 2010 +0000
+++ b/lisp/ChangeLog	Thu Oct 14 01:15:03 2010 +0200
@@ -1,3 +1,7 @@
+2010-10-13  Stephen Berman  <stephen.berman@gmx.net>
+
+	* subr.el (last): Use `safe-length' instead of `length' (bug#7206).
+
 2010-10-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* net/tls.el (tls-program): Remove spurious %s from openssl.
--- a/lisp/subr.el	Wed Oct 13 23:12:47 2010 +0000
+++ b/lisp/subr.el	Thu Oct 14 01:15:03 2010 +0200
@@ -290,10 +290,10 @@
 If N is bigger than the length of LIST, return LIST."
   (if n
       (and (> n 0)
-           (let ((m (length list)))
+           (let ((m (safe-length list)))
              (if (< n m) (nthcdr (- m n) list) list)))
     (and list
-         (nthcdr (1- (length list)) list))))
+         (nthcdr (1- (safe-length list)) list))))
 
 (defun butlast (list &optional n)
   "Return a copy of LIST with the last N elements removed."