From: Stephen Berman Date: Wed, 13 Oct 2010 23:15:03 +0000 (+0200) Subject: lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206). X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~46^2~22 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=88f427d57c2d21b0dcb9ecae03b18f52e8509a1e;p=emacs.git lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8660ded07b1..1ede7a1e1fc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-10-13 Stephen Berman + + * subr.el (last): Use `safe-length' instead of `length' (bug#7206). + 2010-10-13 Lars Magne Ingebrigtsen * net/tls.el (tls-program): Remove spurious %s from openssl. diff --git a/lisp/subr.el b/lisp/subr.el index 0ed4ae62795..dabadec770e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -290,10 +290,10 @@ If N is non-nil, return the Nth-to-last link of LIST. 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."