emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/undo-tree f6471ef 173/195: Simplify undo-list-byte-size


From: Stefan Monnier
Subject: [elpa] externals/undo-tree f6471ef 173/195: Simplify undo-list-byte-size.
Date: Sat, 28 Nov 2020 13:41:47 -0500 (EST)

branch: externals/undo-tree
commit f6471efd52da1222be020a7dc323061912bd84f5
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>

    Simplify undo-list-byte-size.
---
 undo-tree.el | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/undo-tree.el b/undo-tree.el
index 3b0de1f..2cac71d 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -1813,12 +1813,11 @@ Comparison is done with `eq'."
 
 (defun undo-list-byte-size (undo-list)
   ;; Return size (in bytes) of UNDO-LIST
-  (let ((size 0) (p undo-list))
-    (while p
+  (let ((size 0))
+    (dolist (elt undo-list)
       (incf size 8)  ; cons cells use up 8 bytes
-      (when (and (consp (car p)) (stringp (caar p)))
-        (incf size (string-bytes (caar p))))
-      (setq p (cdr p)))
+      (when (stringp (car-safe elt))
+        (incf size (string-bytes (car elt)))))
     size))
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]