]> 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)
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Tue, 15 Jun 2021 19:42:51 +0000 (21:42 +0200)
commit91e58792282d676fbcb3781d2ed48d6b082c6c56
tree53abbf45a286eddbc1ec1c6a29c241fb514e3696
parent84e85611c36d31a478e1b62e5668671d9389265d
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