mirror of https://github.com/minetest/minetest.git
Refactor to utilize std::stringview::substr()
This commit is contained in:
parent
fb5b7e069d
commit
c7bfcd499e
|
@ -175,18 +175,14 @@ SubgameSpec findSubgame(const std::string &id)
|
||||||
found_alias();
|
found_alias();
|
||||||
break;
|
break;
|
||||||
// Make sure a "_game" suffix is ignored
|
// Make sure a "_game" suffix is ignored
|
||||||
} else if (str_ends_with(alias, "_game")) {
|
} else if (str_ends_with(alias, "_game")
|
||||||
std::string_view alias_trimmed{alias.data(), alias.size() - 5};
|
&& alias.substr(0, alias.size() - 5) == id) {
|
||||||
if (alias_trimmed == id) {
|
|
||||||
found_alias();
|
found_alias();
|
||||||
break;
|
break;
|
||||||
}
|
} else if (str_ends_with(id, "_game")
|
||||||
} else if (str_ends_with(id, "_game")) {
|
&& id.substr(0, id.size() - 5) == alias) {
|
||||||
std::string_view id_trimmed{id.data(), id.size() - 5};
|
|
||||||
if (id_trimmed == alias) {
|
|
||||||
found_alias();
|
found_alias();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue