Codechange: StringFilter now uses std::string_view entirely (#13869)

This commit is contained in:
frosch
2025-03-22 20:35:31 +01:00
committed by GitHub
parent 667d013726
commit d4ae0f70da
4 changed files with 19 additions and 6 deletions

View File

@@ -102,10 +102,8 @@ void StringFilter::ResetState()
*
* @param str Another line from the item.
*/
void StringFilter::AddLine(const char *str)
void StringFilter::AddLine(std::string_view str)
{
if (str == nullptr) return;
bool match_case = this->case_sensitive != nullptr && *this->case_sensitive;
for (WordState &ws : this->word_index) {
if (!ws.match) {
@@ -115,7 +113,7 @@ void StringFilter::AddLine(const char *str)
this->word_matches++;
}
} else {
if ((match_case ? strstr(str, ws.word.c_str()) : strcasestr(str, ws.word.c_str())) != nullptr) {
if (match_case ? str.find(ws.word) != str.npos : StrContainsIgnoreCase(str, ws.word)) {
ws.match = true;
this->word_matches++;
}