summaryrefslogtreecommitdiff
path: root/coreutils/od_bloaty.c
diff options
context:
space:
mode:
authorDenys Vlasenko2018-02-22 12:14:55 +0100
committerDenys Vlasenko2018-02-22 12:14:55 +0100
commit3177626033fa58fcb60e29009936f08f16e6a99c (patch)
tree4b6d4d9f6c97dee01409e696eb1e2e71c7b482fc /coreutils/od_bloaty.c
parent2709acbbda8a82ccd18abfe191dcb9dd530e4c57 (diff)
downloadbusybox-3177626033fa58fcb60e29009936f08f16e6a99c.zip
busybox-3177626033fa58fcb60e29009936f08f16e6a99c.tar.gz
od: move address_fmt[] from data to globals. 8 less bytes in data section
function old new delta od_main 2164 2179 +15 address_fmt 8 - -8 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 15/-8) Total: 7 bytes text data bss dec hex filename 930954 481 6852 938287 e512f busybox_old 930977 473 6852 938302 e513e busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/od_bloaty.c')
-rw-r--r--coreutils/od_bloaty.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index c9bb3b8..4cae0c5 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -211,7 +211,14 @@ struct globals {
bool not_first;
bool prev_pair_equal;
+
+ char address_fmt[sizeof("%0n"OFF_FMT"xc")];
} FIX_ALIASING;
+/* Corresponds to 'x' above */
+#define address_base_char G.address_fmt[sizeof(G.address_fmt)-3]
+/* Corresponds to 'n' above */
+#define address_pad_len_char G.address_fmt[2]
+
#if !ENABLE_LONG_OPTS
enum { G_pseudo_offset = 0 };
#endif
@@ -220,6 +227,7 @@ enum { G_pseudo_offset = 0 };
setup_common_bufsiz(); \
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
G.bytes_per_block = 32; \
+ strcpy(G.address_fmt, "%0n"OFF_FMT"xc"); \
} while (0)
@@ -844,18 +852,12 @@ format_address_none(off_t address UNUSED_PARAM, char c UNUSED_PARAM)
{
}
-static char address_fmt[] ALIGN1 = "%0n"OFF_FMT"xc";
-/* Corresponds to 'x' above */
-#define address_base_char address_fmt[sizeof(address_fmt)-3]
-/* Corresponds to 'n' above */
-#define address_pad_len_char address_fmt[2]
-
static void
format_address_std(off_t address, char c)
{
/* Corresponds to 'c' */
- address_fmt[sizeof(address_fmt)-2] = c;
- printf(address_fmt, address);
+ G.address_fmt[sizeof(G.address_fmt)-2] = c;
+ printf(G.address_fmt, address);
}
#if ENABLE_LONG_OPTS