disk_perc: Simplify
Aaron Marcher me@drkhsh.at
Mon, 07 May 2018 11:44:15 +0200
1 files changed,
2 insertions(+),
4 deletions(-)
jump to
M
components/disk.c
→
components/disk.c
@@ -23,7 +23,6 @@
const char * disk_perc(const char *mnt) { - int perc; struct statvfs fs; if (statvfs(mnt, &fs) < 0) {@@ -31,9 +30,8 @@ fprintf(stderr, "statvfs '%s': %s\n", mnt, strerror(errno));
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 *