projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b3330d8
)
disk_perc: Simplify
author
Aaron Marcher
<me@drkhsh.at>
Mon, 7 May 2018 09:44:15 +0000
(11:44 +0200)
committer
Aaron Marcher
<me@drkhsh.at>
Mon, 7 May 2018 09:44:15 +0000
(11:44 +0200)
components/disk.c
patch
|
blob
|
history
diff --git
a/components/disk.c
b/components/disk.c
index 2ce260bb8824c0b4d5039b6e3b5f69aca86c8864..a225421335040ae7bdef9116ab8bb18b18020da4 100644
(file)
--- a/
components/disk.c
+++ b/
components/disk.c
@@
-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) {
@@
-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 *