string-util: add new strrstr_no_case() call

This commit is contained in:
Lennart Poettering
2026-04-17 18:32:20 +02:00
parent 023f88a6ab
commit 2561159d39
3 changed files with 38 additions and 0 deletions
+11
View File
@@ -1530,6 +1530,17 @@ char* strrstr_internal(const char *haystack, const char *needle) {
return NULL;
}
char* strrstr_no_case_internal(const char *haystack, const char *needle) {
if (!haystack || !needle)
return NULL;
for (const char *p = strchr(haystack, 0); p > haystack; p--)
if (startswith_no_case(p, needle))
return (char*) p;
return startswith_no_case(haystack, needle) ? (char*) haystack : NULL;
}
size_t str_common_prefix(const char *a, const char *b) {
assert(a);
assert(b);