From 7c8e7c6b6e16d4a26259a676db32d8776b99817e Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Wed, 10 Apr 2019 22:07:06 +0100 Subject: Codechange: Use null pointer literal instead of the NULL macro --- src/stringfilter.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/stringfilter.cpp') diff --git a/src/stringfilter.cpp b/src/stringfilter.cpp index 88eb5f28a..d0bffb270 100644 --- a/src/stringfilter.cpp +++ b/src/stringfilter.cpp @@ -33,14 +33,14 @@ void StringFilter::SetFilterTerm(const char *str) this->word_matches = 0; free(this->filter_buffer); - assert(str != NULL); + assert(str != nullptr); char *dest = MallocT(strlen(str) + 1); this->filter_buffer = dest; WChar state = STATE_WHITESPACE; const char *pos = str; - WordState *word = NULL; + WordState *word = nullptr; size_t len; for (;; pos += len) { WChar c; @@ -48,9 +48,9 @@ void StringFilter::SetFilterTerm(const char *str) if (c == 0 || (state == STATE_WORD && IsWhitespace(c))) { /* Finish word */ - if (word != NULL) { + if (word != nullptr) { *(dest++) = '\0'; - word = NULL; + word = nullptr; } state = STATE_WHITESPACE; if (c != 0) continue; else break; @@ -75,7 +75,7 @@ void StringFilter::SetFilterTerm(const char *str) } /* Add to word */ - if (word == NULL) { + if (word == nullptr) { /*C++17: word = &*/ this->word_index.push_back({dest, false}); word = &this->word_index.back(); } @@ -106,12 +106,12 @@ void StringFilter::ResetState() */ void StringFilter::AddLine(const char *str) { - if (str == NULL) return; + if (str == nullptr) return; - bool match_case = this->case_sensitive != NULL && *this->case_sensitive; + bool match_case = this->case_sensitive != nullptr && *this->case_sensitive; for (WordState &ws : this->word_index) { if (!ws.match) { - if ((match_case ? strstr(str, ws.start) : strcasestr(str, ws.start)) != NULL) { + if ((match_case ? strstr(str, ws.start) : strcasestr(str, ws.start)) != nullptr) { ws.match = true; this->word_matches++; } -- cgit v1.2.3-54-g00ecf