aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2026-02-15 14:41:20 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2026-02-15 15:15:30 +0100
commitb668e52c906b664b353d5a99cfa3ff36f73b341d (patch)
tree85ab744c5dd15c21633b89a518ff001225c98494 /libbb
parent9e8f8a196838b63acdbd2c9b48a2a333bc885e8b (diff)
downloadbusybox-w32-b668e52c906b664b353d5a99cfa3ff36f73b341d.tar.gz
busybox-w32-b668e52c906b664b353d5a99cfa3ff36f73b341d.tar.bz2
busybox-w32-b668e52c906b664b353d5a99cfa3ff36f73b341d.zip
*: 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 <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/get_last_path_component.c4
-rw-r--r--libbb/replace.c3
-rw-r--r--libbb/strrstr.c4
-rw-r--r--libbb/xfuncs_printf.c2
4 files changed, 7 insertions, 6 deletions
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c
index 04fdf2a3e..f9d56ad23 100644
--- a/libbb/get_last_path_component.c
+++ b/libbb/get_last_path_component.c
@@ -24,12 +24,12 @@ const char* FAST_FUNC bb_basename(const char *name)
24 */ 24 */
25char* FAST_FUNC bb_get_last_path_component_nostrip(const char *path) 25char* FAST_FUNC bb_get_last_path_component_nostrip(const char *path)
26{ 26{
27 char *slash = strrchr(path, '/'); 27 const char *slash = strrchr(path, '/');
28 28
29 if (!slash || (slash == path && !slash[1])) 29 if (!slash || (slash == path && !slash[1]))
30 return (char*)path; 30 return (char*)path;
31 31
32 return slash + 1; 32 return (char*)slash + 1;
33} 33}
34 34
35/* 35/*
diff --git a/libbb/replace.c b/libbb/replace.c
index bc26b04cc..273330f8a 100644
--- a/libbb/replace.c
+++ b/libbb/replace.c
@@ -28,7 +28,8 @@ unsigned FAST_FUNC count_strstr(const char *str, const char *sub)
28 28
29char* FAST_FUNC xmalloc_substitute_string(const char *src, int count, const char *sub, const char *repl) 29char* FAST_FUNC xmalloc_substitute_string(const char *src, int count, const char *sub, const char *repl)
30{ 30{
31 char *buf, *dst, *end; 31 char *buf, *dst;
32 const char *end;
32 size_t sub_len = strlen(sub); 33 size_t sub_len = strlen(sub);
33 size_t repl_len = strlen(repl); 34 size_t repl_len = strlen(repl);
34 35
diff --git a/libbb/strrstr.c b/libbb/strrstr.c
index a173b034f..bea5d1773 100644
--- a/libbb/strrstr.c
+++ b/libbb/strrstr.c
@@ -19,10 +19,10 @@ char* FAST_FUNC strrstr(const char *haystack, const char *needle)
19 if (!needle[0]) 19 if (!needle[0])
20 return (char*)haystack + strlen(haystack); 20 return (char*)haystack + strlen(haystack);
21 while (1) { 21 while (1) {
22 char *p = strstr(haystack, needle); 22 const char *p = strstr(haystack, needle);
23 if (!p) 23 if (!p)
24 return r; 24 return r;
25 r = p; 25 r = (char *)p;
26 haystack = p + 1; 26 haystack = p + 1;
27 } 27 }
28} 28}
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index ed10084b3..8afa1ef68 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -379,7 +379,7 @@ void FAST_FUNC bb_unsetenv(const char *var)
379 char onstack[128 - 16]; /* smaller stack setup code on x86 */ 379 char onstack[128 - 16]; /* smaller stack setup code on x86 */
380 char *tp; 380 char *tp;
381 381
382 tp = strchr(var, '='); 382 tp = (char*)strchr(var, '=');
383 if (tp) { 383 if (tp) {
384 /* In case var was putenv'ed, we can't replace '=' 384 /* In case var was putenv'ed, we can't replace '='
385 * with NUL and unsetenv(var) - it won't work, 385 * with NUL and unsetenv(var) - it won't work,