summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorLaslo Hunhold <dev@frign.de>2018-05-21 20:08:56 +0200
committerAaron Marcher <me@drkhsh.at>2018-05-21 20:28:57 +0200
commitceb13206a4d9f410ab49c3824c487658c341d8c8 (patch)
tree37b71f8c5a78befb648e081ebe66c6c67f582940 /util.h
parent10dbc9543edd5b5a7929dd8fa87ed33dd545375c (diff)
Refactor fmt_human() and fix a bug
It is not necessary to copy memory or anything. Just keep a pointer to the active prefix-array and assign the length of the arrays to a variable. Make the code more readable by using a switch, be more strict when an invalid base is passed to it and fix a small oversight in the bottom of the code where the base 1024 was forgotten to generalized.
Diffstat (limited to 'util.h')
-rw-r--r--util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/util.h b/util.h
index faa1472..b474f88 100644
--- a/util.h
+++ b/util.h
@@ -10,5 +10,5 @@ void die(const char *, ...);
int esnprintf(char *str, size_t size, const char *fmt, ...);
const char *bprintf(const char *fmt, ...);
-const char *fmt_human(size_t num, int iec);
+const char *fmt_human(size_t num, int base);
int pscanf(const char *path, const char *fmt, ...);