Style: Replaces uses of 0/NULL by nullptr (C++11)

Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
This commit is contained in:
Rémi Verschelde
2021-05-04 16:00:45 +02:00
parent 2b429b24b5
commit a828398655
633 changed files with 4454 additions and 4410 deletions

View File

@ -72,7 +72,7 @@ int RegExMatch::get_group_count() const {
Dictionary RegExMatch::get_names() const {
Dictionary result;
for (const Map<String, int>::Element *i = names.front(); i != NULL; i = i->next()) {
for (const Map<String, int>::Element *i = names.front(); i != nullptr; i = i->next()) {
result[i->key()] = i->value();
}
@ -161,13 +161,13 @@ void RegEx::clear() {
if (sizeof(CharType) == 2) {
if (code) {
pcre2_code_free_16((pcre2_code_16 *)code);
code = NULL;
code = nullptr;
}
} else {
if (code) {
pcre2_code_free_32((pcre2_code_32 *)code);
code = NULL;
code = nullptr;
}
}
}
@ -218,7 +218,7 @@ Error RegEx::compile(const String &p_pattern) {
}
Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end) const {
ERR_FAIL_COND_V(!is_valid(), NULL);
ERR_FAIL_COND_V(!is_valid(), nullptr);
Ref<RegExMatch> result = memnew(RegExMatch);
@ -238,7 +238,7 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)
if (res < 0) {
pcre2_match_data_free_16(match);
return NULL;
return nullptr;
}
uint32_t size = pcre2_get_ovector_count_16(match);
@ -268,7 +268,7 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)
pcre2_match_data_free_32(match);
pcre2_match_context_free_32(mctx);
return NULL;
return nullptr;
}
uint32_t size = pcre2_get_ovector_count_32(match);
@ -397,7 +397,7 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a
}
bool RegEx::is_valid() const {
return (code != NULL);
return (code != nullptr);
}
String RegEx::get_pattern() const {
@ -439,22 +439,22 @@ Array RegEx::get_names() const {
RegEx::RegEx() {
if (sizeof(CharType) == 2) {
general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, NULL);
general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, nullptr);
} else {
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, NULL);
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
}
code = NULL;
code = nullptr;
}
RegEx::RegEx(const String &p_pattern) {
if (sizeof(CharType) == 2) {
general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, NULL);
general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, nullptr);
} else {
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, NULL);
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
}
code = NULL;
code = nullptr;
compile(p_pattern);
}