[hackers] [slstatus] disk_perc: Simplify || Aaron Marcher
commit 4fc4983502243b916acac7d61c09529ee744d759
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Mon May 7 11:44:15 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Mon May 7 11:44:15 2018 +0200
disk_perc: Simplify
diff --git a/components/disk.c b/components/disk.c
index 2ce260b..a225421 100644
--- a/components/disk.c
+++ b/components/disk.c
_AT_@ -23,7 +23,6 @@ disk_free(const char *mnt)
const char *
disk_perc(const char *mnt)
{
- int perc;
struct statvfs fs;
if (statvfs(mnt, &fs) < 0) {
_AT_@ -31,9 +30,8 @@ disk_perc(const char *mnt)
return NULL;
}
- perc = 100 * (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks));
-
- return bprintf("%d", perc);
+ return bprintf("%d", 100 *
+ (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks)));
}
const char *
Received on Mon May 07 2018 - 12:15:13 CEST
This archive was generated by hypermail 2.3.0
: Mon May 07 2018 - 12:24:24 CEST