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
1
Makefile
1
Makefile
|
@ -206,6 +206,7 @@ CFLAGS += $(ARCH_FLAGS) \
|
|||
-fdata-sections \
|
||||
-pedantic \
|
||||
$(DEVICE_FLAGS) \
|
||||
-D_GNU_SOURCE \
|
||||
-DUSE_STDPERIPH_DRIVER \
|
||||
-D$(TARGET) \
|
||||
$(TARGET_FLAGS) \
|
||||
|
|
|
@ -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