summaryrefslogtreecommitdiff
path: root/src/stringfilter.cpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-02-17 11:20:52 +0000
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commitab711e6942757d775c08c31a6c32d488feba1dba (patch)
treed102dc6d0e6b9c33e7205b63e3360ebd720a3ebb /src/stringfilter.cpp
parent297fd3dda3abe353ebe2fe77c67b011e24d403bc (diff)
downloadopenttd-ab711e6942757d775c08c31a6c32d488feba1dba.tar.xz
Codechange: Replaced SmallVector::[Begin|End]() with std alternatives
Diffstat (limited to 'src/stringfilter.cpp')
-rw-r--r--src/stringfilter.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/stringfilter.cpp b/src/stringfilter.cpp
index e546a4186..88eb5f28a 100644
--- a/src/stringfilter.cpp
+++ b/src/stringfilter.cpp
@@ -91,9 +91,8 @@ void StringFilter::SetFilterTerm(const char *str)
void StringFilter::ResetState()
{
this->word_matches = 0;
- const WordState *end = this->word_index.End();
- for (WordState *it = this->word_index.Begin(); it != end; ++it) {
- it->match = false;
+ for (WordState &ws : this->word_index) {
+ ws.match = false;
}
}
@@ -110,11 +109,10 @@ void StringFilter::AddLine(const char *str)
if (str == NULL) return;
bool match_case = this->case_sensitive != NULL && *this->case_sensitive;
- const WordState *end = this->word_index.End();
- for (WordState *it = this->word_index.Begin(); it != end; ++it) {
- if (!it->match) {
- if ((match_case ? strstr(str, it->start) : strcasestr(str, it->start)) != NULL) {
- it->match = true;
+ for (WordState &ws : this->word_index) {
+ if (!ws.match) {
+ if ((match_case ? strstr(str, ws.start) : strcasestr(str, ws.start)) != NULL) {
+ ws.match = true;
this->word_matches++;
}
}