[PATCH 6/8] string: add strcasestr()
Rasmus Villemoes
rv at rasmusvillemoes.dk
Wed Jul 8 20:40:59 CEST 2026
On Thu, Jul 02 2026, "Simon Glass" <sjg at chromium.org> wrote:
> Hi Rasmus,
>
> On 2026-07-01T17:15:27, Rasmus Villemoes <rv at rasmusvillemoes.dk> wrote:
>> string: add strcasestr()
>>
>> While this is not likely needed by any 'real' driver code, a later
>> convenience addition to the 'config' command will need this. As usual,
>> the linker will throw it away if nothing actually uses it, so it
>> should have no size impact when not used.
>>
>> Signed-off-by: Rasmus Villemoes <rv at rasmusvillemoes.dk>
>>
>> include/linux/string.h | 1 +
>> lib/string.c | 27 +++++++++++++++++++++++++++
>> 2 files changed, 28 insertions(+)
>
>> diff --git a/include/linux/string.h b/include/linux/string.h
>> @@ -77,6 +77,7 @@ extern __kernel_size_t strlen(const char *);
>> #ifndef __HAVE_ARCH_STRNLEN
>> extern __kernel_size_t strnlen(const char *,__kernel_size_t);
>> #endif
>> +char *strcasestr(const char *, const char *);
>
> I've been trying to add proper function docs to newly added ones, so
> we can clearly see the behaviour. Despite these being well-known
> function, they sometimes differ in how they handle edge-conditions.
>
> Also you could group this with the strstr()/strnstr() declarations a
> few lines above, so it sits alongside its siblings.
Sure, I can move the declaration up. As for function docs, they exist,
but in string.c, which is also where the docs for str[n]str is (an
earlier patch had fixups for those). I see some kernel docs in
string.h, and I dunno which is preferred, but most, including the
sibling str[n]str ones, are in the .c file. So I'll leave it there.
Rasmus
More information about the U-Boot
mailing list