diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-05-28 13:32:07 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-05-28 13:32:07 +0200 |
commit | 9790eb73c8b7ed1a1015f58e1fe85de0508c0526 (patch) | |
tree | 4d288ddcbe199edd24ae69015798e1e6830516b4 | |
parent | 21dce1c3c3d74a60959b6d8b0c76f38d463b8187 (diff) | |
download | busybox-w32-9790eb73c8b7ed1a1015f58e1fe85de0508c0526.tar.gz busybox-w32-9790eb73c8b7ed1a1015f58e1fe85de0508c0526.tar.bz2 busybox-w32-9790eb73c8b7ed1a1015f58e1fe85de0508c0526.zip |
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 70f15c9bd..b406a2428 100644 --- a/libbb/dump.c +++ b/libbb/dump.c | |||
@@ -47,8 +47,10 @@ typedef struct priv_dumper_t { | |||
47 | static const char dot_flags_width_chars[] ALIGN1 = ".#-+ 0123456789"; | 47 | static const char dot_flags_width_chars[] ALIGN1 = ".#-+ 0123456789"; |
48 | 48 | ||
49 | static const char size_conv_str[] ALIGN1 = | 49 | static const char size_conv_str[] ALIGN1 = |
50 | "\x1\x4\x4\x4\x4\x4\x4\x8\x8\x8\x8\010cdiouxXeEfgG"; | 50 | "\x1\x4\x4\x4\x4\x4\x4\x8\x8\x8\x8\x8""cdiouxXeEfgG"; |
51 | 51 | /* c d i o u x X e E f g G - bytes contain 'bcnt' for the type */ | |
52 | #define SCS_OFS 12 | ||
53 | #define float_convs (size_conv_str + SCS_OFS + sizeof("cdiouxX")-1) | ||
52 | static const char int_convs[] ALIGN1 = "diouxX"; | 54 | static const char int_convs[] ALIGN1 = "diouxX"; |
53 | 55 | ||
54 | dumper_t* FAST_FUNC alloc_dumper(void) | 56 | dumper_t* FAST_FUNC alloc_dumper(void) |
@@ -88,7 +90,7 @@ static NOINLINE int bb_dump_size(FS *fs) | |||
88 | while (isdigit(*++fmt)) | 90 | while (isdigit(*++fmt)) |
89 | continue; | 91 | continue; |
90 | } | 92 | } |
91 | p = strchr(size_conv_str + 12, *fmt); | 93 | p = strchr(size_conv_str + SCS_OFS, *fmt); |
92 | if (!p) { | 94 | if (!p) { |
93 | if (*fmt == 's') { | 95 | if (*fmt == 's') { |
94 | bcnt += prec; | 96 | bcnt += prec; |
@@ -100,7 +102,7 @@ static NOINLINE int bb_dump_size(FS *fs) | |||
100 | } | 102 | } |
101 | } | 103 | } |
102 | } else { | 104 | } else { |
103 | bcnt += p[-12]; | 105 | bcnt += p[-SCS_OFS]; |
104 | } | 106 | } |
105 | } | 107 | } |
106 | cur_size += bcnt * fu->reps; | 108 | cur_size += bcnt * fu->reps; |
@@ -204,7 +206,7 @@ static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs) | |||
204 | if (strchr(int_convs, *p1)) { /* %d etc */ | 206 | if (strchr(int_convs, *p1)) { /* %d etc */ |
205 | goto DO_INT_CONV; | 207 | goto DO_INT_CONV; |
206 | } else | 208 | } else |
207 | if (strchr("eEfgG", *p1)) { /* floating point */ | 209 | if (strchr(float_convs, *p1)) { /* floating point */ |
208 | pr->flags = F_DBL; | 210 | pr->flags = F_DBL; |
209 | byte_count_str = "\010\004"; | 211 | byte_count_str = "\010\004"; |
210 | goto DO_BYTE_COUNT; | 212 | goto DO_BYTE_COUNT; |