From: Stefan Kangas Date: Sat, 15 Oct 2022 01:02:17 +0000 (+0200) Subject: Use file-size-human-readable in memory-report--format X-Git-Tag: emacs-29.0.90~1616^2~618 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8300899953cf903f2e3dcf2e985b16044959df7c;p=emacs.git Use file-size-human-readable in memory-report--format * lisp/emacs-lisp/memory-report.el (memory-report--format): Use file-size-human-readable. --- diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el index 56b1ea6ed48..968a80b59e7 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))