From b668e52c906b664b353d5a99cfa3ff36f73b341d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 15 Feb 2026 14:41:20 +0100 Subject: *: placate warnings where strchr/strstr returns constant pointer Newer glibc is now smarter and can propagate const-ness from those! function old new delta readtoken1 3111 3108 -3 Signed-off-by: Denys Vlasenko --- coreutils/od_bloaty.c | 7 ++++--- coreutils/printf.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'coreutils') diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index e886a4ed2..c0e6681f2 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c @@ -1155,7 +1155,7 @@ dump_strings(off_t address, off_t end_offset) leading '+' return nonzero and set *OFFSET to the offset it denotes. */ static int -parse_old_offset(const char *s, off_t *offset) +parse_old_offset(char *s, off_t *offset) { static const struct suffix_mult Bb[] ALIGN_SUFFIX = { { "B", 1024 }, @@ -1181,7 +1181,8 @@ parse_old_offset(const char *s, off_t *offset) radix = 16; *offset = xstrtooff_sfx(s, radix, Bb); - if (p) p[0] = '.'; + if (p) + p[0] = '.'; /* undo cheating */ return (*offset >= 0); } @@ -1234,7 +1235,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) static const uint8_t doxn_address_pad_len_char[] ALIGN1 = { '7', '7', '6', /* '?' */ }; - char *p; + const char *p; int pos; p = strchr(doxn, str_A[0]); if (!p) diff --git a/coreutils/printf.c b/coreutils/printf.c index 4edcfa9b5..3cd48cfcc 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c @@ -354,7 +354,7 @@ static char **print_formatted(char *f, char **argv, int *conv_err) /* Add "ll" if integer modifier, then print */ { static const char format_chars[] ALIGN1 = "diouxXfeEgGcs"; - char *p = strchr(format_chars, *f); + char *p = (char*)strchr(format_chars, *f); /* needed - try "printf %" without it */ if (p == NULL || *f == '\0') { bb_error_msg("%s: invalid format", direc_start); -- cgit v1.2.3-55-g6feb