]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
string: correct prototype of strchrnul()
authorRasmus Villemoes <rv@rasmusvillemoes.dk>
Wed, 8 Jul 2026 20:37:03 +0000 (22:37 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 21 Jul 2026 19:51:06 +0000 (13:51 -0600)
Both glibc's (where this originated as a GNU extension) and the
kernel's versions of strchrnul() return "char *", not "const
char *". That also makes it consistent with the standard strchr()
function.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
include/linux/string.h
lib/string.c

index 850356d7c3fe6ad9ed18b355c67211ba7ca5c03c..488a459ed99da3b73d93fc512e06ab27a0b78486 100644 (file)
@@ -63,7 +63,7 @@ extern char * strchr(const char *,int);
  * @c: character to search for
  * Return: position of @c in @s, or end of @s if not found
  */
-const char *strchrnul(const char *s, int c);
+char *strchrnul(const char *s, int c);
 
 #ifndef __HAVE_ARCH_STRRCHR
 extern char * strrchr(const char *,int);
index 37ea8c295619180d9cd4855e938d6c08c39721bc..a76dcd48d20b88385c51ecad9293a587a40beb7a 100644 (file)
@@ -263,12 +263,12 @@ char * strchr(const char * s, int c)
 }
 #endif
 
-const char *strchrnul(const char *s, int c)
+char *strchrnul(const char *s, int c)
 {
        for (; *s != (char)c; ++s)
                if (*s == '\0')
                        break;
-       return s;
+       return (char *)s;
 }
 
 #ifndef __HAVE_ARCH_STRRCHR