libbb/human_readable.c: shrink; and reduce bss usage
also, move smart_ulltoaN there and comment usage locations function old new delta static.unit_chars 7 9 +2 utoa_to_buf 110 108 -2 make_human_readable_str 262 258 -4 fallbackSort 1723 1719 -4 static.fmt 97 92 -5 static.fmt_tenths 10 - -10 static.str 21 4 -17 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/5 up/down: 2/-42) Total: -40 bytes text data bss dec hex filename 820981 453 6932 828366 ca3ce busybox_old 820968 453 6916 828337 ca3b1 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -58,14 +58,17 @@ static void print(unsigned long size, const char *filename)
|
||||
{
|
||||
/* TODO - May not want to defer error checking here. */
|
||||
#if ENABLE_FEATURE_HUMAN_READABLE
|
||||
printf("%s\t%s\n", make_human_readable_str(size, 512, G.disp_hr),
|
||||
printf("%s\t%s\n",
|
||||
/* size x 512 / G.disp_hr, show one fractional,
|
||||
* use suffixes if G.disp_hr == 0 */
|
||||
make_human_readable_str(size, 512, G.disp_hr),
|
||||
filename);
|
||||
#else
|
||||
if (G.disp_k) {
|
||||
size++;
|
||||
size >>= 1;
|
||||
}
|
||||
printf("%ld\t%s\n", size, filename);
|
||||
printf("%lu\t%s\n", size, filename);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user