From 9e743c99fb69db5694c388ae33656c62e3fa0b8e Mon Sep 17 00:00:00 2001 From: Fawrsk Date: Sat, 7 Jan 2023 00:38:12 -0400 Subject: Cleanup for loops in llcommon to use C++11 range based for loops --- indra/llcommon/llassettype.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'indra/llcommon/llassettype.cpp') diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index e6cc06e8d0..4e6cebc5eb 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -150,14 +150,12 @@ LLAssetType::EType LLAssetType::lookup(const char* name) LLAssetType::EType LLAssetType::lookup(const std::string& type_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - for (LLAssetDictionary::const_iterator iter = dict->begin(); - iter != dict->end(); - iter++) + for (const LLAssetDictionary::value_type pair : *dict) { - const AssetEntry *entry = iter->second; + const AssetEntry *entry = pair.second; if (type_name == entry->mTypeName) { - return iter->first; + return pair.first; } } return AT_UNKNOWN; @@ -188,14 +186,12 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name) LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - for (LLAssetDictionary::const_iterator iter = dict->begin(); - iter != dict->end(); - iter++) + for (const LLAssetDictionary::value_type pair : *dict) { - const AssetEntry *entry = iter->second; + const AssetEntry *entry = pair.second; if (entry->mHumanName && (readable_name == entry->mHumanName)) { - return iter->first; + return pair.first; } } return AT_NONE; -- cgit v1.2.3 From 8767e6995b0c9b9ed23e07f63d290a1da8c70f17 Mon Sep 17 00:00:00 2001 From: Fawrsk Date: Mon, 9 Jan 2023 19:19:12 -0400 Subject: Eliminate needless copies --- indra/llcommon/llassettype.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/llassettype.cpp') diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 4e6cebc5eb..4c84223dad 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -150,7 +150,7 @@ LLAssetType::EType LLAssetType::lookup(const char* name) LLAssetType::EType LLAssetType::lookup(const std::string& type_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - for (const LLAssetDictionary::value_type pair : *dict) + for (const LLAssetDictionary::value_type& pair : *dict) { const AssetEntry *entry = pair.second; if (type_name == entry->mTypeName) @@ -186,7 +186,7 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name) LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - for (const LLAssetDictionary::value_type pair : *dict) + for (const LLAssetDictionary::value_type& pair : *dict) { const AssetEntry *entry = pair.second; if (entry->mHumanName && (readable_name == entry->mHumanName)) -- cgit v1.2.3