1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +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

@@ -403,7 +403,7 @@ void Input::joy_connection_changed(int p_idx, bool p_connected, String p_name, S
if (p_connected) {
String uidname = p_guid;
if (p_guid == "") {
if (p_guid.is_empty()) {
int uidlen = MIN(p_name.length(), 16);
for (int i = 0; i < uidlen; i++) {
uidname = uidname + _hex_str(p_name[i]);
@@ -1249,7 +1249,7 @@ void Input::parse_mapping(String p_mapping) {
int idx = 1;
while (++idx < entry.size()) {
if (entry[idx] == "") {
if (entry[idx].is_empty()) {
continue;
}
@@ -1420,10 +1420,10 @@ Input::Input() {
// If defined, parse SDL_GAMECONTROLLERCONFIG for possible new mappings/overrides.
String env_mapping = OS::get_singleton()->get_environment("SDL_GAMECONTROLLERCONFIG");
if (env_mapping != "") {
if (!env_mapping.is_empty()) {
Vector<String> entries = env_mapping.split("\n");
for (int i = 0; i < entries.size(); i++) {
if (entries[i] == "") {
if (entries[i].is_empty()) {
continue;
}
parse_mapping(entries[i]);