1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Replace String comparisons with "", String() to is_empty()

Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
This commit is contained in:
Nathan Franke
2021-12-09 03:42:46 -06:00
parent 31ded7e126
commit 49403cbfa0
226 changed files with 1051 additions and 1034 deletions

View File

@@ -232,8 +232,7 @@ bool PluginScript::instance_has(const Object *p_this) const {
}
bool PluginScript::has_source_code() const {
bool has = _source != "";
return has;
return !_source.is_empty();
}
String PluginScript::get_source_code() const {
@@ -257,11 +256,11 @@ Error PluginScript::reload(bool p_keep_state) {
_valid = false;
String basedir = _path;
if (basedir == "") {
if (basedir.is_empty()) {
basedir = get_path();
}
if (basedir != "") {
if (!basedir.is_empty()) {
basedir = basedir.get_base_dir();
}

View File

@@ -44,9 +44,9 @@
static List<PluginScriptLanguage *> pluginscript_languages;
static Error _check_language_desc(const godot_pluginscript_language_desc *desc) {
ERR_FAIL_COND_V(!desc->name || desc->name == String(), ERR_BUG);
ERR_FAIL_COND_V(!desc->type || desc->type == String(), ERR_BUG);
ERR_FAIL_COND_V(!desc->extension || desc->extension == String(), ERR_BUG);
ERR_FAIL_COND_V(!desc->name, ERR_BUG);
ERR_FAIL_COND_V(!desc->type, ERR_BUG);
ERR_FAIL_COND_V(!desc->extension, ERR_BUG);
ERR_FAIL_COND_V(!desc->recognized_extensions || !desc->recognized_extensions[0], ERR_BUG);
ERR_FAIL_COND_V(!desc->init, ERR_BUG);
ERR_FAIL_COND_V(!desc->finish, ERR_BUG);