1
0
Fork 0
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:
Petr Ledvina 2018-03-14 14:17:23 +01:00 committed by Michael Keller
parent 31b3959221
commit eee15e7ca4
2 changed files with 13 additions and 0 deletions

View file

@ -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;
}