]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
string: correct documentation for strstr and strnstr
authorRasmus Villemoes <rv@rasmusvillemoes.dk>
Wed, 8 Jul 2026 20:37:04 +0000 (22:37 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 21 Jul 2026 19:51:06 +0000 (13:51 -0600)
The len parameter for strnstr() concerns the maximum size of the
haystack to consider, not the length of the needle being searched for.

strstr() obviously has no len parameter, so remove the copy-pasta.

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

index a76dcd48d20b88385c51ecad9293a587a40beb7a..45f0f5f8d09c2d3ebc0ea6f2c49e1061cd9c3377 100644 (file)
@@ -702,7 +702,7 @@ void *memdup(const void *src, size_t len)
  *
  * @s1:                string to be searched
  * @s2:                string to search for
- * @len:       maximum number of characters in s2 to consider
+ * @len:       maximum number of characters in s1 to consider
  *
  * Return:     pointer to the first occurrence or NULL
  */
@@ -728,7 +728,6 @@ char *strnstr(const char *s1, const char *s2, size_t len)
  *
  * @s1:                string to be searched
  * @s2:                string to search for
- * @len:       maximum number of characters in s2 to consider
  *
  * Return:     pointer to the first occurrence or NULL
  */