1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Introduce std::string_view into wider use (#14368)

This commit is contained in:
sfan5 2024-02-17 15:35:33 +01:00 committed by GitHub
parent fa47af737f
commit 6ca214fefc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 501 additions and 456 deletions

View file

@ -1142,17 +1142,16 @@ bool NodeDefManager::getIds(const std::string &name,
std::vector<content_t> &result) const
{
//TimeTaker t("getIds", NULL, PRECISION_MICRO);
if (name.substr(0,6) != "group:") {
if (!str_starts_with(name, "group:")) {
content_t id = CONTENT_IGNORE;
bool exists = getId(name, id);
if (exists)
result.push_back(id);
return exists;
}
std::string group = name.substr(6);
std::unordered_map<std::string, std::vector<content_t>>::const_iterator
i = m_group_to_items.find(group);
std::string group = name.substr(6);
auto i = m_group_to_items.find(group);
if (i == m_group_to_items.end())
return true;
@ -1847,7 +1846,7 @@ bool NodeResolver::getIdsFromNrBacklog(std::vector<content_t> *result_out,
content_t c;
std::string &name = m_nodenames[m_nodenames_idx++];
if (name.substr(0,6) != "group:") {
if (!str_starts_with(name, "group:")) {
if (m_ndef->getId(name, c)) {
result_out->push_back(c);
} else if (all_required) {