sbm

simple bandwidth monitor
git clone git://git.2f30.org/sbm
Log | Files | Refs | LICENSE

commit 50b1e130528331a6d5e0b6e34bba7d88403c91fc
parent 5241b7259dd364107c2542aaaaebfbf91041e773
Author: sin <sin@2f30.org>
Date:   Sun, 31 Jul 2016 10:00:57 +0100

Initialize variable inside for()

Diffstat:
Msbm.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbm.c b/sbm.c @@ -148,11 +148,11 @@ scale(char **suffix, uint64_t bits) static char *suffixes[][5] = { { "b", "kb", "Mb", "Gb", "Tb" }, { "B", "kB", "MB", "GB", "TB" } }; double rounded = bits; - int unit = 0; + int unit; if (Bflag) rounded /= 8; - for (; rounded >= 1000 && unit < 4; ++unit) + for (unit = 0; rounded >= 1000 && unit < 4; ++unit) rounded /= 1000; *suffix = suffixes[Bflag][unit]; return rounded;