From c72b43c2f07e5fae288fff9e220b1f88e2889a72 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 13 Jul 2013 23:49:45 +0200 Subject: Commonalize typical [b,]k,m suffix struct function old new delta bkm_suffixes - 32 +32 static.km_suffixes 24 - -24 suffixes 32 - -32 static.bkm 32 - -32 head_tail_suffixes 32 - -32 ------------------------------------------------------------------------------ (add/remove: 2/6 grow/shrink: 0/0 up/down: 72/-160) Total: -88 bytes Signed-off-by: Denys Vlasenko --- coreutils/od_bloaty.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'coreutils/od_bloaty.c') diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index b408a8477..2c26dda16 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c @@ -1166,12 +1166,6 @@ parse_old_offset(const char *s, off_t *offset) int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int od_main(int argc UNUSED_PARAM, char **argv) { - static const struct suffix_mult bkm[] = { - { "b", 512 }, - { "k", 1024 }, - { "m", 1024*1024 }, - { "", 0 } - }; #if ENABLE_LONG_OPTS static const char od_longopts[] ALIGN1 = "skip-bytes\0" Required_argument "j" @@ -1230,7 +1224,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) address_pad_len_char = doxn_address_pad_len_char[pos]; } if (opt & OPT_N) { - max_bytes_to_format = xstrtooff_sfx(str_N, 0, bkm); + max_bytes_to_format = xstrtooff_sfx(str_N, 0, bkm_suffixes); } if (opt & OPT_a) decode_format_string("a"); if (opt & OPT_b) decode_format_string("oC"); @@ -1239,7 +1233,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) if (opt & OPT_f) decode_format_string("fF"); if (opt & OPT_h) decode_format_string("x2"); if (opt & OPT_i) decode_format_string("d2"); - if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm); + if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm_suffixes); if (opt & OPT_l) decode_format_string("d4"); if (opt & OPT_o) decode_format_string("o2"); while (lst_t) { @@ -1248,7 +1242,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) if (opt & OPT_x) decode_format_string("x2"); if (opt & OPT_s) decode_format_string("d2"); if (opt & OPT_S) { - string_min = xstrtou_sfx(str_S, 0, bkm); + string_min = xstrtou_sfx(str_S, 0, bkm_suffixes); } // Bloat: -- cgit v1.2.3