summaryrefslogtreecommitdiff
path: root/coreutils/od_bloaty.c
diff options
context:
space:
mode:
authorDenys Vlasenko2013-07-13 23:49:45 +0200
committerDenys Vlasenko2013-07-13 23:49:45 +0200
commitc72b43c2f07e5fae288fff9e220b1f88e2889a72 (patch)
tree4577ff27d4aefdb610b3e26fbf13651f8a01c81d /coreutils/od_bloaty.c
parent0dacb68e1a660b235f9098abd33577be2e147c67 (diff)
downloadbusybox-c72b43c2f07e5fae288fff9e220b1f88e2889a72.zip
busybox-c72b43c2f07e5fae288fff9e220b1f88e2889a72.tar.gz
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 <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/od_bloaty.c')
-rw-r--r--coreutils/od_bloaty.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index b408a84..2c26dda 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: