emacs-diffs
[Top][All Lists]
Advanced

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

master 8300899953: Use file-size-human-readable in memory-report--format


From: Stefan Kangas
Subject: master 8300899953: Use file-size-human-readable in memory-report--format
Date: Fri, 14 Oct 2022 22:44:41 -0400 (EDT)

branch: master
commit 8300899953cf903f2e3dcf2e985b16044959df7c
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Use file-size-human-readable in memory-report--format
    
    * lisp/emacs-lisp/memory-report.el (memory-report--format): Use
    file-size-human-readable.
---
 lisp/emacs-lisp/memory-report.el | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el
index 56b1ea6ed4..968a80b59e 100644
--- a/lisp/emacs-lisp/memory-report.el
+++ b/lisp/emacs-lisp/memory-report.el
@@ -262,12 +262,7 @@ by counted more than once."
                    (cl-struct-slot-info struct-type)))))
 
 (defun memory-report--format (bytes)
-  (setq bytes (/ bytes 1024.0))
-  (let ((units '("KiB" "MiB" "GiB" "TiB")))
-    (while (>= bytes 1024)
-      (setq bytes (/ bytes 1024.0))
-      (setq units (cdr units)))
-    (format "%6.1f %s" bytes (car units))))
+  (format "%10s" (file-size-human-readable bytes 'iec " ")))
 
 (defun memory-report--gc-elem (elems type)
   (* (nth 1 (assq type elems))



reply via email to

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