Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-05-26 21:17:04 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2023-05-26 21:17:04 +0300
commit6d9427420bab4ef756444fc8800dbf56d7dacf7d (patch)
tree29e4cd2a8812999000a5b324daf308adee83ce25 /coreutils
parent5dcc443dba039b305a510c01883e9f34e42656ae (diff)
od: -l,I,L indeed depend on sizeof(long), fix this
function old new delta .rodata 105255 105252 -3 od_main 1917 1901 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19) Total: -19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/od.c21
-rw-r--r--coreutils/od_bloaty.c10
2 files changed, 20 insertions, 11 deletions
diff --git a/coreutils/od.c b/coreutils/od.c
index 3684e4ed3..a7b1ba444 100644
--- a/coreutils/od.c
+++ b/coreutils/od.c
@@ -170,12 +170,17 @@ static const char *const add_strings[] ALIGN_PTR = {
"4/4 \" %15.7e\"" "\"\n\"", /* 7: f */
"4/4 \" %08x\"" "\"\n\"", /* 8: H, X */
"8/2 \" %04x\"" "\"\n\"", /* 9: h, x */
- /* This probably also depends on word width of the arch (what is "long"?) */
- /* should be "2/8" or "4/4" depending on sizeof(long)? */
- "2/8 \" %20lld\"" "\"\n\"", /* 10: I, L, l */
- "4/4 \" %11d\"" "\"\n\"", /* 11: i */
- "4/4 \" %011o\"" "\"\n\"", /* 12: O */
- "8/2 \" %6d\"" "\"\n\"", /* 13: s */
+ "4/4 \" %11d\"" "\"\n\"", /* 10: i */
+ "4/4 \" %011o\"" "\"\n\"", /* 11: O */
+ "8/2 \" %6d\"" "\"\n\"", /* 12: s */
+ /* -I,L,l: depend on word width of the arch (what is "long"?) */
+#if ULONG_MAX > 0xffffffff
+ "2/8 \" %20lld\"" "\"\n\"", /* 13: I, L, l */
+#define L_ 13
+#else
+ /* 32-bit arch: -I,L,l are the same as -i */
+#define L_ 10
+#endif
};
static const char od_opts[] ALIGN1 = "aBbcDdeFfHhIiLlOoXxsv";
@@ -183,8 +188,8 @@ static const char od_opts[] ALIGN1 = "aBbcDdeFfHhIiLlOoXxsv";
static const char od_o2si[] ALIGN1 = {
0, 1, 2, 3, 5, /* aBbcD */
4, 6, 6, 7, 8, /* deFfH */
- 9, 10, 11, 10, 10, /* hIiLl */
- 12, 1, 8, 9, 13 /* OoXxs */
+ 9, L_, 10, L_, L_, /* hIiLl */
+ 11, 1, 8, 9, 12 /* OoXxs */
};
int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 2782adbf6..e886a4ed2 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -1257,11 +1257,15 @@ int od_main(int argc UNUSED_PARAM, char **argv)
if (opt & OPT_f) decode_format_string("fF");
if (opt & (OPT_h|OPT_x)) decode_format_string("x2");
if (opt & (OPT_H|OPT_X)) decode_format_string("xI");
+ /* -I,L,l: depend on word width of the arch (what is "long"?) */
+#if ULONG_MAX > 0xffffffff
if (opt & OPT_i) decode_format_string("dI");
+ if (opt & (OPT_I|OPT_l|OPT_L)) decode_format_string("dL");
+#else
+ /* 32-bit arch: -I,L,l are the same as -i */
+ if (opt & (OPT_i|OPT_I|OPT_l|OPT_L)) decode_format_string("dI");
+#endif
if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm_suffixes);
- /* This probably also depends on word width of the arch (what is "long"?) */
- /* should be "d4" or "d8" depending on sizeof(long)? */
- if (opt & (OPT_I|OPT_l|OPT_L)) decode_format_string("d8");
if (opt & (OPT_o|OPT_B)) decode_format_string("o2");
if (opt & OPT_O) decode_format_string("oI");
while (lst_t) {