From 6dd7029942dcc381d670657e0c4bb7d8dcd24594 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 5 Apr 2012 18:11:45 -0700
Subject: optimized Lazy<T> params - don't generate block when checking
 validity or merging

---
 indra/llxuixml/llinitparam.h | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index 6c054b934b..1f0dec5d94 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -436,6 +436,12 @@ namespace LLInitParam
 				return *this;
 			}
 
+			bool operator==(const Lazy& other) const
+			{
+				if (empty() || other.empty()) return false;
+				return *mPtr == *other.mPtr;
+			}
+
 			bool empty() const
 			{
 				return mPtr == NULL;
@@ -1966,17 +1972,6 @@ namespace LLInitParam
 		static const bool value = false;
 	};
 
-	template<typename T, bool IS_BLOCK>
-	struct ParamCompare<BaseBlock::Lazy<T, IS_BLOCK>, false>
-	{
-		static bool equals(const BaseBlock::Lazy<T, IS_BLOCK>& a, const BaseBlock::Lazy<T, IS_BLOCK>& b)
-		{
-			if (a.empty() || b.empty()) return false;
-			return a.get() == b.get();
-		}
-	};
-
-
 	template<typename T>
 	class ParamValue <BaseBlock::Lazy<T, true>,
 					TypeValues<BaseBlock::Lazy<T, true> >,
@@ -2045,19 +2040,17 @@ namespace LLInitParam
 
 		bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const
 		{
-			if (mValue.empty()) return false;
-
 			return mValue.get().inspectBlock(p, name_stack, min_count, max_count);
 		}
 
 		bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite)
 		{
-			return mValue.get().mergeBlock(block_data, source.getValue(),  overwrite);
+			return source.mValue.empty() || mValue.get().mergeBlock(block_data, source.getValue(),  overwrite);
 		}
 
 		bool validateBlock(bool emit_errors = true) const
 		{
-			return mValue.get().validateBlock(emit_errors);
+			return mValue.empty() || mValue.get().validateBlock(emit_errors);
 		}
 
 		static BlockDescriptor& getBlockDescriptor()
-- 
cgit v1.2.3