Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:

committed by
Michael Lutz

parent
3b4f224c0b
commit
7c8e7c6b6e
@@ -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<char>(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++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user