summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-04-12 12:55:52 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2021-04-12 12:55:52 -0400
commitc42dc493d1af7fd1ba73c64ba481f017858c24f6 (patch)
tree66971220be215a2fd58a807cf2349c04eb6702a0 /lisp/emacs-lisp
parentbe75b08f8214545c9991e157e83e1c864503f25c (diff)
downloademacs-c42dc493d1af7fd1ba73c64ba481f017858c24f6.tar.gz
emacs-c42dc493d1af7fd1ba73c64ba481f017858c24f6.tar.bz2
emacs-c42dc493d1af7fd1ba73c64ba481f017858c24f6.zip
* lisp/emacs-lisp/memory-report.el (memory-report--object-size-1): Simplify
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/memory-report.el18
1 files changed, 9 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el
index ecbca280e59..f4f03133b0f 100644
--- a/lisp/emacs-lisp/memory-report.el
+++ b/lisp/emacs-lisp/memory-report.el
@@ -182,7 +182,7 @@ by counted more than once."
(cl-defmethod memory-report--object-size-1 (_ (value symbol))
;; Don't count global symbols -- makes sizes of lists of symbols too
- ;; heavey.
+ ;; heavy.
(if (intern-soft value obarray)
0
(memory-report--size 'symbol)))
@@ -214,14 +214,14 @@ by counted more than once."
(setf (gethash value counted) t)
(when (car value)
(cl-incf total (memory-report--object-size counted (car value))))
- (if (cdr value)
- (if (consp (cdr value))
- (if (gethash (cdr value) counted)
- (setq value nil)
- (setq value (cdr value)))
- (cl-incf total (memory-report--object-size counted (cdr value)))
- (setq value nil))
- (setq value nil)))
+ (let ((next (cdr value)))
+ (setq value (when next
+ (if (consp next)
+ (unless (gethash next counted)
+ (cdr value))
+ (cl-incf total (memory-report--object-size
+ counted next))
+ nil)))))
total))
(cl-defmethod memory-report--object-size-1 (counted (value vector))