]> granicus.if.org Git - procps-ng/commit
free: Clean up scale_size and fix `free -h --si`
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Tue, 15 Jun 2021 18:43:36 +0000 (20:43 +0200)
committerCraig Small <csmall@dropbear.xyz>
Wed, 16 Jun 2021 09:46:39 +0000 (19:46 +1000)
commit4e400b5942005af3509e190dc6e28fb69600946e
treee1f3954074a0d6850c35269f87fb033d681553fc
parent8281ac4f98cf04c51cbeb746d214201531d660ec
free: Clean up scale_size and fix `free -h --si`

- Simplify control flow a bit. We don't need two loop variables, either.
- Consistently use %lld for bytes.
- Fix the base handling for human-readable output. The code used to
  calculate *mebibytes* first, then scale that to the required exponent
  with the selected base, which is patently wrong.

Fixes https://gitlab.com/procps-ng/procps/-/issues/133
free.c