From 88f427d57c2d21b0dcb9ecae03b18f52e8509a1e Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Thu, 14 Oct 2010 01:15:03 +0200 Subject: [PATCH] lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206). --- lisp/ChangeLog | 4 ++++ lisp/subr.el | 4 ++-- 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 @@ +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." -- 2.39.5