diff options
| -rw-r--r-- | coreutils/od_bloaty.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index c9bb3b85f..4cae0c529 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
| @@ -211,7 +211,14 @@ struct globals { | |||
| 211 | 211 | ||
| 212 | bool not_first; | 212 | bool not_first; |
| 213 | bool prev_pair_equal; | 213 | bool prev_pair_equal; |
| 214 | |||
| 215 | char address_fmt[sizeof("%0n"OFF_FMT"xc")]; | ||
| 214 | } FIX_ALIASING; | 216 | } FIX_ALIASING; |
| 217 | /* Corresponds to 'x' above */ | ||
| 218 | #define address_base_char G.address_fmt[sizeof(G.address_fmt)-3] | ||
| 219 | /* Corresponds to 'n' above */ | ||
| 220 | #define address_pad_len_char G.address_fmt[2] | ||
| 221 | |||
| 215 | #if !ENABLE_LONG_OPTS | 222 | #if !ENABLE_LONG_OPTS |
| 216 | enum { G_pseudo_offset = 0 }; | 223 | enum { G_pseudo_offset = 0 }; |
| 217 | #endif | 224 | #endif |
| @@ -220,6 +227,7 @@ enum { G_pseudo_offset = 0 }; | |||
| 220 | setup_common_bufsiz(); \ | 227 | setup_common_bufsiz(); \ |
| 221 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ | 228 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
| 222 | G.bytes_per_block = 32; \ | 229 | G.bytes_per_block = 32; \ |
| 230 | strcpy(G.address_fmt, "%0n"OFF_FMT"xc"); \ | ||
| 223 | } while (0) | 231 | } while (0) |
| 224 | 232 | ||
| 225 | 233 | ||
| @@ -844,18 +852,12 @@ format_address_none(off_t address UNUSED_PARAM, char c UNUSED_PARAM) | |||
| 844 | { | 852 | { |
| 845 | } | 853 | } |
| 846 | 854 | ||
| 847 | static char address_fmt[] ALIGN1 = "%0n"OFF_FMT"xc"; | ||
| 848 | /* Corresponds to 'x' above */ | ||
| 849 | #define address_base_char address_fmt[sizeof(address_fmt)-3] | ||
| 850 | /* Corresponds to 'n' above */ | ||
| 851 | #define address_pad_len_char address_fmt[2] | ||
| 852 | |||
| 853 | static void | 855 | static void |
| 854 | format_address_std(off_t address, char c) | 856 | format_address_std(off_t address, char c) |
| 855 | { | 857 | { |
| 856 | /* Corresponds to 'c' */ | 858 | /* Corresponds to 'c' */ |
| 857 | address_fmt[sizeof(address_fmt)-2] = c; | 859 | G.address_fmt[sizeof(G.address_fmt)-2] = c; |
| 858 | printf(address_fmt, address); | 860 | printf(G.address_fmt, address); |
| 859 | } | 861 | } |
| 860 | 862 | ||
| 861 | #if ENABLE_LONG_OPTS | 863 | #if ENABLE_LONG_OPTS |
