Document the literal-only needle constraint of the ESP8266 macro

This commit is contained in:
J. Nick Koston
2026-08-20 18:01:57 -05:00
parent daaaa13318
commit b1464d594b
2 changed files with 4 additions and 1 deletions
+2
View File
@@ -234,6 +234,8 @@ bool str_contains_ignore_case_fallback(const char *haystack, const char *needle)
}
#ifdef USE_ESP8266
// _P mirror of str_contains_ignore_case_fallback above; host tests cover only the fallback,
// so keep the two bodies in sync.
bool str_contains_ignore_case_p(const char *haystack, PGM_P needle) {
if (haystack == nullptr || needle == nullptr) {
return false;
+2 -1
View File
@@ -989,7 +989,8 @@ bool str_contains_ignore_case_fallback(const char *haystack, const char *needle)
/// `str_contains_ignore_case` macro which wraps needle literals with PSTR() automatically.
bool str_contains_ignore_case_p(const char *haystack, PGM_P needle);
/// Case-insensitive check if needle string is contained in haystack (no heap allocation).
/// On ESP8266 the needle literal is wrapped with PSTR() so it stays in flash.
/// On ESP8266 the needle is wrapped with PSTR() so it stays in flash, which requires it to be
/// a string literal; pass a runtime needle to str_contains_ignore_case_p directly instead.
#define str_contains_ignore_case(haystack, needle) str_contains_ignore_case_p(haystack, PSTR(needle))
#else
/// Case-insensitive check if needle string is contained in haystack (no heap allocation).