mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Implement minimalistic strcasestr (#5411)
* Implement minimalistic strcasestr * fixup! Implement minimalistic strcasestr * Add _GNU_SOURCE Enable gcc extensions * fixup! fixup! Implement minimalistic strcasestr
This commit is contained in:
parent
31b3959221
commit
eee15e7ca4
2 changed files with 13 additions and 0 deletions
|
@ -78,3 +78,15 @@ int strncasecmp(const char * s1, const char * s2, size_t n)
|
|||
|
||||
return d;
|
||||
}
|
||||
|
||||
char *strcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
int nLen = strlen(needle);
|
||||
do {
|
||||
if (!strncasecmp(haystack, needle, nLen)) {
|
||||
return (char *)haystack;
|
||||
}
|
||||
haystack++;
|
||||
} while (*haystack);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue