diff options
author | Denys Vlasenko | 2023-05-28 13:32:07 +0200 |
---|---|---|
committer | Denys Vlasenko | 2023-05-28 13:32:07 +0200 |
commit | 9790eb73c8b7ed1a1015f58e1fe85de0508c0526 (patch) | |
tree | 4d288ddcbe199edd24ae69015798e1e6830516b4 | |
parent | 21dce1c3c3d74a60959b6d8b0c76f38d463b8187 (diff) | |
download | busybox-9790eb73c8b7ed1a1015f58e1fe85de0508c0526.zip busybox-9790eb73c8b7ed1a1015f58e1fe85de0508c0526.tar.gz |
libbb/dump: code shrink
function old new delta
.rodata 105252 105246 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/dump.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libbb/dump.c b/libbb/dump.c index 70f15c9..b406a24 100644 --- a/libbb/dump.c +++ b/libbb/dump.c @@ -47,8 +47,10 @@ typedef struct priv_dumper_t { static const char dot_flags_width_chars[] ALIGN1 = ".#-+ 0123456789"; static const char size_conv_str[] ALIGN1 = -"\x1\x4\x4\x4\x4\x4\x4\x8\x8\x8\x8\010cdiouxXeEfgG"; - +"\x1\x4\x4\x4\x4\x4\x4\x8\x8\x8\x8\x8""cdiouxXeEfgG"; +/* c d i o u x X e E f g G - bytes contain 'bcnt' for the type */ +#define SCS_OFS 12 +#define float_convs (size_conv_str + SCS_OFS + sizeof("cdiouxX")-1) static const char int_convs[] ALIGN1 = "diouxX"; dumper_t* FAST_FUNC alloc_dumper(void) @@ -88,7 +90,7 @@ static NOINLINE int bb_dump_size(FS *fs) while (isdigit(*++fmt)) continue; } - p = strchr(size_conv_str + 12, *fmt); + p = strchr(size_conv_str + SCS_OFS, *fmt); if (!p) { if (*fmt == 's') { bcnt += prec; @@ -100,7 +102,7 @@ static NOINLINE int bb_dump_size(FS *fs) } } } else { - bcnt += p[-12]; + bcnt += p[-SCS_OFS]; } } cur_size += bcnt * fu->reps; @@ -204,7 +206,7 @@ static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs) if (strchr(int_convs, *p1)) { /* %d etc */ goto DO_INT_CONV; } else - if (strchr("eEfgG", *p1)) { /* floating point */ + if (strchr(float_convs, *p1)) { /* floating point */ pr->flags = F_DBL; byte_count_str = "\010\004"; goto DO_BYTE_COUNT; |