aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2010-10-14 01:15:03 +0200
committerJuanma Barranquero2010-10-14 01:15:03 +0200
commit88f427d57c2d21b0dcb9ecae03b18f52e8509a1e (patch)
treeec202567e5bd7856d1c9b70771d06374ea48d89f
parentd1090fe81cb9fed04d3564a17ff9445b70d9f092 (diff)
downloademacs-88f427d57c2d21b0dcb9ecae03b18f52e8509a1e.tar.gz
emacs-88f427d57c2d21b0dcb9ecae03b18f52e8509a1e.zip
lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206).
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/subr.el4
2 files changed, 6 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8660ded07b1..1ede7a1e1fc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12010-10-13 Stephen Berman <stephen.berman@gmx.net>
2
3 * subr.el (last): Use `safe-length' instead of `length' (bug#7206).
4
12010-10-13 Lars Magne Ingebrigtsen <larsi@gnus.org> 52010-10-13 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 6
3 * net/tls.el (tls-program): Remove spurious %s from openssl. 7 * 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.
290If N is bigger than the length of LIST, return LIST." 290If N is bigger than the length of LIST, return LIST."
291 (if n 291 (if n
292 (and (> n 0) 292 (and (> n 0)
293 (let ((m (length list))) 293 (let ((m (safe-length list)))
294 (if (< n m) (nthcdr (- m n) list) list))) 294 (if (< n m) (nthcdr (- m n) list) list)))
295 (and list 295 (and list
296 (nthcdr (1- (length list)) list)))) 296 (nthcdr (1- (safe-length list)) list))))
297 297
298(defun butlast (list &optional n) 298(defun butlast (list &optional n)
299 "Return a copy of LIST with the last N elements removed." 299 "Return a copy of LIST with the last N elements removed."