[hackers] [slstatus] Implement fmt_scaled for disk_* functions || Aaron Marcher
commit b3e56066ed5349c6fd0afe1ac7cf5035e16a8a2f
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Fri May 18 23:14:55 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Fri May 18 23:14:55 2018 +0200
Implement fmt_scaled for disk_* functions
diff --git a/components/disk.c b/components/disk.c
index f4031ea..00deea2 100644
--- a/components/disk.c
+++ b/components/disk.c
_AT_@ -16,8 +16,7 @@ disk_free(const char *mnt)
return NULL;
}
- return bprintf("%f",
- (float)fs.f_frsize * (float)fs.f_bavail / 1024 / 1024 / 1024);
+ return fmt_scaled(fs.f_frsize * fs.f_bavail);
}
const char *
_AT_@ -44,8 +43,7 @@ disk_total(const char *mnt)
return NULL;
}
- return bprintf("%f",
- (float)fs.f_frsize * (float)fs.f_blocks / 1024 / 1024 / 1024);
+ return fmt_scaled(fs.f_frsize * fs.f_blocks);
}
const char *
_AT_@ -58,7 +56,5 @@ disk_used(const char *mnt)
return NULL;
}
- return bprintf("%f",
- (float)fs.f_frsize * ((float)fs.f_blocks -
- (float)fs.f_bfree) / 1024 / 1024 / 1024);
+ return fmt_scaled(fs.f_frsize * (fs.f_blocks - fs.f_bfree));
}
Received on Fri May 18 2018 - 23:15:18 CEST
This archive was generated by hypermail 2.3.0
: Fri May 18 2018 - 23:24:29 CEST