diff options
author | Fawrsk <fawrsk@gmail.com> | 2023-01-09 19:19:12 -0400 |
---|---|---|
committer | Fawrsk <fawrsk@gmail.com> | 2023-01-09 19:19:12 -0400 |
commit | 8767e6995b0c9b9ed23e07f63d290a1da8c70f17 (patch) | |
tree | 26c8c15b117bc183386af1ee6e8b6617708aeba7 /indra/llcommon | |
parent | 9e743c99fb69db5694c388ae33656c62e3fa0b8e (diff) |
Eliminate needless copies
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llassettype.cpp | 4 | ||||
-rw-r--r-- | indra/llcommon/llcallbacklist.cpp | 5 | ||||
-rw-r--r-- | indra/llcommon/llcallstack.cpp | 4 | ||||
-rw-r--r-- | indra/llcommon/lldependencies.h | 6 | ||||
-rw-r--r-- | indra/llcommon/llerror.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/llheteromap.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/llinitparam.cpp | 18 | ||||
-rw-r--r-- | indra/llcommon/llinitparam.h | 4 | ||||
-rw-r--r-- | indra/llcommon/llmetricperformancetester.cpp | 4 | ||||
-rw-r--r-- | indra/llcommon/llnametable.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llsdparam.cpp | 2 |
11 files changed, 27 insertions, 26 deletions
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)) diff --git a/indra/llcommon/llcallbacklist.cpp b/indra/llcommon/llcallbacklist.cpp index aea19c6424..93d0a035da 100644 --- a/indra/llcommon/llcallbacklist.cpp +++ b/indra/llcommon/llcallbacklist.cpp @@ -109,9 +109,10 @@ void LLCallbackList::deleteAllFunctions() void LLCallbackList::callFunctions() { - for (callback_list_t::value_type pair : mCallbackList) + for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); ) { - pair.first(pair.second); + callback_list_t::iterator curiter = iter++; + curiter->first(curiter->second); } } diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp index fac03e0c9e..83d5ae2a63 100644 --- a/indra/llcommon/llcallstack.cpp +++ b/indra/llcommon/llcallstack.cpp @@ -154,7 +154,7 @@ bool LLContextStrings::contains(const std::string& str) { const std::map<std::string,S32>& strings = LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings; - for (const std::map<std::string,S32>::value_type str_pair : strings) + for (const std::map<std::string,S32>::value_type& str_pair : strings) { if (str_pair.first.find(str) != std::string::npos) { @@ -169,7 +169,7 @@ void LLContextStrings::output(std::ostream& os) { const std::map<std::string,S32>& strings = LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings; - for (const std::map<std::string,S32>::value_type str_pair : strings) + for (const std::map<std::string,S32>::value_type& str_pair : strings) { os << str_pair.first << "[" << str_pair.second << "]" << "\n"; } diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h index ba5fcb195c..fa54a944c8 100644 --- a/indra/llcommon/lldependencies.h +++ b/indra/llcommon/lldependencies.h @@ -514,7 +514,7 @@ public: // former broken behavior has finally been fixed -- and our builds // treat warnings as errors. { - for (typename const DepNodeMap::value_type nm_pair : mNodes) + for (typename const DepNodeMap::value_type& nm_pair : mNodes) { vmap.insert(typename VertexMap::value_type(nm_pair.first, vmap.size())); for (typename const KEY& after_k : nm_pair.second.after) @@ -531,7 +531,7 @@ public: // all the known key dependencies to integer pairs. EdgeList edges; { - for (typename const DepNodeMap::value_type nm_pair : mNodes) + for (typename const DepNodeMap::value_type& nm_pair : mNodes) { auto thisnode = vmap[nm_pair.first]; // after dependencies: build edges from the named node to this one @@ -555,7 +555,7 @@ public: // and we're certain that the associated int values are distinct // indexes. The fact that they're not in order is irrelevant. KeyList vkeys(vmap.size()); - for (typename const VertexMap::value_type vm_pair : vmap) + for (typename const VertexMap::value_type& vm_pair : vmap) { vkeys[vm_pair.second] = vm_pair.first; } diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index c5eb515292..310da2c9f0 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1222,7 +1222,7 @@ namespace std::string escaped_message; LLMutexLock lock(&s->mRecorderMutex); - for (LLError::RecorderPtr r : s->mRecorders) + for (LLError::RecorderPtr& r : s->mRecorders) { if (!r->enabled()) { diff --git a/indra/llcommon/llheteromap.cpp b/indra/llcommon/llheteromap.cpp index 4bc29a1736..c84e49d085 100644 --- a/indra/llcommon/llheteromap.cpp +++ b/indra/llcommon/llheteromap.cpp @@ -22,7 +22,7 @@ LLHeteroMap::~LLHeteroMap() { // For each entry in our map, we must call its deleter, which is the only // record we have of its original type. - for (TypeMap::value_type pair : mMap) + for (TypeMap::value_type& pair : mMap) { // pair.second is the std::pair; pair.second.first is the void*; // pair.second.second points to the deleter function diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp index 12765bb1dc..9d3394b4f7 100644 --- a/indra/llcommon/llinitparam.cpp +++ b/indra/llcommon/llinitparam.cpp @@ -207,7 +207,7 @@ namespace LLInitParam if (!mValidated) { const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - for (const BlockDescriptor::param_validation_list_t::value_type pair : block_data.mValidationList) + for (const BlockDescriptor::param_validation_list_t::value_type& pair : block_data.mValidationList) { const Param* param = getParamFromHandle(pair.first); if (!pair.second(param)) @@ -235,7 +235,7 @@ namespace LLInitParam // unnamed param is like LLView::Params::rect - implicit const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - for (const ParamDescriptorPtr ptr : block_data.mUnnamedParams) + for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams) { param_handle_t param_handle = ptr->mParamHandle; const Param* param = getParamFromHandle(param_handle); @@ -247,7 +247,7 @@ namespace LLInitParam } } - for (const BlockDescriptor::param_map_t::value_type pair : block_data.mNamedParams) + for (const BlockDescriptor::param_map_t::value_type& pair : block_data.mNamedParams) { param_handle_t param_handle = pair.second->mParamHandle; const Param* param = getParamFromHandle(param_handle); @@ -257,7 +257,7 @@ namespace LLInitParam // Ensure this param has not already been serialized // Prevents <rect> from being serialized as its own tag. bool duplicate = false; - for (const ParamDescriptorPtr ptr : block_data.mUnnamedParams) + for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams) { if (param_handle == ptr->mParamHandle) { @@ -294,7 +294,7 @@ namespace LLInitParam // unnamed param is like LLView::Params::rect - implicit const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - for (const ParamDescriptorPtr ptr : block_data.mUnnamedParams) + for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams) { param_handle_t param_handle = ptr->mParamHandle; const Param* param = getParamFromHandle(param_handle); @@ -307,7 +307,7 @@ namespace LLInitParam } } - for(const BlockDescriptor::param_map_t::value_type pair : block_data.mNamedParams) + for(const BlockDescriptor::param_map_t::value_type& pair : block_data.mNamedParams) { param_handle_t param_handle = pair.second->mParamHandle; const Param* param = getParamFromHandle(param_handle); @@ -370,7 +370,7 @@ namespace LLInitParam } // try to parse unnamed parameters, in declaration order - for (ParamDescriptorPtr ptr : block_data.mUnnamedParams) + for (ParamDescriptorPtr& ptr : block_data.mUnnamedParams) { Param* paramp = getParamFromHandle(ptr->mParamHandle); ParamDescriptor::deserialize_func_t deserialize_func = ptr->mDeserializeFunc; @@ -439,7 +439,7 @@ namespace LLInitParam { param_handle_t handle = getHandleFromParam(¶m); BlockDescriptor& descriptor = mostDerivedBlockDescriptor(); - for (ParamDescriptorPtr ptr : descriptor.mAllParams) + for (ParamDescriptorPtr& ptr : descriptor.mAllParams) { if (ptr->mParamHandle == handle) return ptr; } @@ -451,7 +451,7 @@ namespace LLInitParam bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) { bool some_param_changed = false; - for (const ParamDescriptorPtr ptr : block_data.mAllParams) + for (const ParamDescriptorPtr& ptr : block_data.mAllParams) { const Param* other_paramp = other.getParamFromHandle(ptr->mParamHandle); ParamDescriptor::merge_func_t merge_func = ptr->mMergeFunc; diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 16829249b8..9edc7e40f3 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -325,7 +325,7 @@ namespace LLInitParam std::string calcValueName(const value_t& value) const { value_name_map_t* map = getValueNames(); - for (typename value_name_map_t::value_type map_pair : *map) + for (typename value_name_map_t::value_type& map_pair : *map) { if (ParamCompare<T>::equals(map_pair.second, value)) { @@ -374,7 +374,7 @@ namespace LLInitParam static std::vector<std::string> sValues; value_name_map_t* map = getValueNames(); - for (typename value_name_map_t::value_type map_pair : *map) + for (typename value_name_map_t::value_type& map_pair : *map) { sValues.push_back(map_pair.first); } diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index a981865e62..ab509b46eb 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -42,7 +42,7 @@ LLMetricPerformanceTesterBasic::name_tester_map_t LLMetricPerformanceTesterBasic /*static*/ void LLMetricPerformanceTesterBasic::cleanupClass() { - for (name_tester_map_t::value_type pair : sTesterMap) + for (name_tester_map_t::value_type& pair : sTesterMap) { delete pair.second; } @@ -154,7 +154,7 @@ void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std llofstream os(output.c_str()); os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; - for (LLMetricPerformanceTesterBasic::name_tester_map_t::value_type pair : LLMetricPerformanceTesterBasic::sTesterMap) + for (LLMetricPerformanceTesterBasic::name_tester_map_t::value_type& pair : LLMetricPerformanceTesterBasic::sTesterMap) { LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)pair.second); tester->analyzePerformance(&os, &base, ¤t) ; diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h index 51247d61ba..2c8e71263e 100644 --- a/indra/llcommon/llnametable.h +++ b/indra/llcommon/llnametable.h @@ -86,7 +86,7 @@ public: // O(N)! (currently only used in one place... (newsim/llstate.cpp)) const char *resolveData(const DATA &data) const { - for (const name_map_t::value_type pair : mNameMap) + for (const name_map_t::value_type& pair : mNameMap) { if (pair.second == data) return pair.first; diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index 7f3d3c2d77..30f49b27ea 100644 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp @@ -113,7 +113,7 @@ void LLParamSDParser::writeSDImpl(LLSD& sd, const LLInitParam::BaseBlock& block, /*virtual*/ std::string LLParamSDParser::getCurrentElementName() { std::string full_name = "sd"; - for (name_stack_t::value_type stack_pair : mNameStack) + for (name_stack_t::value_type& stack_pair : mNameStack) { full_name += llformat("[%s]", stack_pair.first.c_str()); } |