diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-05-26 14:46:29 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-05-26 14:46:29 +0200 |
commit | 283cba78f2c9ea8478ef58ba616197df31640353 (patch) | |
tree | f47301d8ad84ae37c04e2ea9cf5d5f26defa384f | |
parent | 34751d8bf921a2c07cf9a7ce9074756a3d936013 (diff) | |
download | busybox-w32-283cba78f2c9ea8478ef58ba616197df31640353.tar.gz busybox-w32-283cba78f2c9ea8478ef58ba616197df31640353.tar.bz2 busybox-w32-283cba78f2c9ea8478ef58ba616197df31640353.zip |
hexdump, xxd: shrink strings
function old new delta
add_first 12 10 -2
.rodata 105321 105306 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-17) Total: -17 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | util-linux/hexdump.c | 20 | ||||
-rw-r--r-- | util-linux/hexdump_xxd.c | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 307a84803..421fe025d 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c | |||
@@ -72,14 +72,14 @@ static void bb_dump_addfile(dumper_t *dumper, char *name) | |||
72 | } | 72 | } |
73 | 73 | ||
74 | static const char *const add_strings[] ALIGN_PTR = { | 74 | static const char *const add_strings[] ALIGN_PTR = { |
75 | "\"%07.7_ax \"16/1 \"%03o \"\"\n\"", /* b */ | 75 | "\"%07_ax\"16/1 \" %03o\"" "\"\n\"", /* b */ |
76 | "\"%07.7_ax \"16/1 \"%3_c \"\"\n\"", /* c */ | 76 | "\"%07_ax\"16/1 \" %3_c\"" "\"\n\"", /* c */ |
77 | "\"%07.7_ax \"8/2 \" %05u \"\"\n\"", /* d */ | 77 | "\"%07_ax\"8/2 \" %05u\"" "\"\n\"", /* d */ |
78 | "\"%07.7_ax \"8/2 \" %06o \"\"\n\"", /* o */ | 78 | "\"%07_ax\"8/2 \" %06o\"" "\"\n\"", /* o */ |
79 | "\"%07.7_ax \"8/2 \" %04x \"\"\n\"", /* x */ | 79 | "\"%07_ax\"8/2 \" %04x\"" "\"\n\"", /* x */ |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static const char add_first[] ALIGN1 = "\"%07.7_Ax\n\""; | 82 | static const char add_first[] ALIGN1 = "\"%07_Ax\n\""; |
83 | 83 | ||
84 | static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v"; | 84 | static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v"; |
85 | 85 | ||
@@ -110,9 +110,9 @@ int hexdump_main(int argc, char **argv) | |||
110 | /* Save a little bit of space below by omitting the 'else's. */ | 110 | /* Save a little bit of space below by omitting the 'else's. */ |
111 | if (ch == 'C') { | 111 | if (ch == 'C') { |
112 | hd_applet: | 112 | hd_applet: |
113 | bb_dump_add(dumper, "\"%08.8_Ax\n\""); // final address line after dump | 113 | bb_dump_add(dumper, "\"%08_Ax\n\""); // final address line after dump |
114 | //------------------- "address " 8 * "xx " " " 8 * "xx " | 114 | //------------------- "address " 8 * " xx" " " 8 * " xx" |
115 | bb_dump_add(dumper, "\"%08.8_ax \"8/1 \"%02x \"\" \"8/1 \"%02x \""); | 115 | bb_dump_add(dumper, "\"%08_ax \"8/1 \" %02x\"\" \"8/1 \" %02x\""); |
116 | //------------------- " |ASCII...........|\n" | 116 | //------------------- " |ASCII...........|\n" |
117 | bb_dump_add(dumper, "\" |\"16/1 \"%_p\"\"|\n\""); | 117 | bb_dump_add(dumper, "\" |\"16/1 \"%_p\"\"|\n\""); |
118 | } | 118 | } |
@@ -140,7 +140,7 @@ int hexdump_main(int argc, char **argv) | |||
140 | 140 | ||
141 | if (!dumper->fshead) { | 141 | if (!dumper->fshead) { |
142 | bb_dump_add(dumper, add_first); | 142 | bb_dump_add(dumper, add_first); |
143 | bb_dump_add(dumper, "\"%07.7_ax \"8/2 \"%04x \"\"\n\""); | 143 | bb_dump_add(dumper, "\"%07_ax\"8/2 \" %04x\"\"\n\""); |
144 | } | 144 | } |
145 | 145 | ||
146 | argv += optind; | 146 | argv += optind; |
diff --git a/util-linux/hexdump_xxd.c b/util-linux/hexdump_xxd.c index 9738a76ad..636cbfeec 100644 --- a/util-linux/hexdump_xxd.c +++ b/util-linux/hexdump_xxd.c | |||
@@ -285,7 +285,7 @@ int xxd_main(int argc UNUSED_PARAM, char **argv) | |||
285 | // output is " 0xXX, 0xXX, 0xXX...", add leading space | 285 | // output is " 0xXX, 0xXX, 0xXX...", add leading space |
286 | bb_dump_add(dumper, "\" \""); | 286 | bb_dump_add(dumper, "\" \""); |
287 | } else | 287 | } else |
288 | bb_dump_add(dumper, "\"%08.8_ax: \""); // "address: " | 288 | bb_dump_add(dumper, "\"%08_ax: \""); // "address: " |
289 | } | 289 | } |
290 | 290 | ||
291 | if (bytes < 1 || bytes >= cols) { | 291 | if (bytes < 1 || bytes >= cols) { |