diff options
Diffstat (limited to 'libbb/human_readable.c')
-rw-r--r-- | libbb/human_readable.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/libbb/human_readable.c b/libbb/human_readable.c index 0b2eb777e..5c7fc076f 100644 --- a/libbb/human_readable.c +++ b/libbb/human_readable.c | |||
@@ -37,8 +37,6 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val, | |||
37 | '\0', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' | 37 | '\0', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static char *str; | ||
41 | |||
42 | unsigned frac; /* 0..9 - the fractional digit */ | 40 | unsigned frac; /* 0..9 - the fractional digit */ |
43 | const char *u; | 41 | const char *u; |
44 | const char *fmt; | 42 | const char *fmt; |
@@ -81,12 +79,7 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val, | |||
81 | #endif | 79 | #endif |
82 | } | 80 | } |
83 | 81 | ||
84 | if (!str) { | 82 | return auto_string(xasprintf(fmt, val, frac, *u)); |
85 | /* sufficient for any width of val */ | ||
86 | str = xmalloc(sizeof(val)*3 + 2 + 3); | ||
87 | } | ||
88 | sprintf(str, fmt, val, frac, *u); | ||
89 | return str; | ||
90 | } | 83 | } |
91 | 84 | ||
92 | 85 | ||