diff options
| author | Stephen Berman | 2010-10-14 01:15:03 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2010-10-14 01:15:03 +0200 |
| commit | 88f427d57c2d21b0dcb9ecae03b18f52e8509a1e (patch) | |
| tree | ec202567e5bd7856d1c9b70771d06374ea48d89f | |
| parent | d1090fe81cb9fed04d3564a17ff9445b70d9f092 (diff) | |
| download | emacs-88f427d57c2d21b0dcb9ecae03b18f52e8509a1e.tar.gz emacs-88f427d57c2d21b0dcb9ecae03b18f52e8509a1e.zip | |
lisp/subr.el (last): Use `safe-length' instead of `length' (bug#7206).
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2010-10-13 Stephen Berman <stephen.berman@gmx.net> | ||
| 2 | |||
| 3 | * subr.el (last): Use `safe-length' instead of `length' (bug#7206). | ||
| 4 | |||
| 1 | 2010-10-13 Lars Magne Ingebrigtsen <larsi@gnus.org> | 5 | 2010-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. | |||
| 290 | If N is bigger than the length of LIST, return LIST." | 290 | If 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." |