From 74dcc04e69b845e62d25e83b615399f8a5d26d21 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 17 Mar 2014 15:57:15 -0700 Subject: Updated experience cache to get a const reference to xp data --- indra/llmessage/llexperiencecache.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'indra/llmessage/llexperiencecache.cpp') diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 648e2039a6..c8deaac1ef 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -320,9 +320,9 @@ namespace LLExperienceCache for ( ; it != mKeys.end(); ++it) { - LLSD exp; + LLSD exp = get(it->first); //leave the properties alone if we already have a cache entry for this xp - if(!get(it->first, exp)) + if(exp.isUndefined()) { exp[PROPERTIES]=PROPERTY_INVALID; } @@ -563,24 +563,21 @@ namespace LLExperienceCache LL_WARNS("ExperienceCache") << ": Ignoring cache insert of experience which is missing " << EXPERIENCE_ID << LL_ENDL; } } - - bool get( const LLUUID& key, LLSD& experience_data ) + static LLSD empty; + const LLSD& get(const LLUUID& key) { - if(key.isNull()) return false; + if(key.isNull()) return empty; cache_t::const_iterator it = sCache.find(key); - + if (it != sCache.end()) { - experience_data = it->second; - return true; + return it->second; } - + fetch(key); - return false; + return empty; } - - void get( const LLUUID& key, callback_slot_t slot ) { if(key.isNull()) return; -- cgit v1.2.3