From 4eb37563b40fc35237c6e5a8d2670f63dc60034a Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 5 Nov 2014 08:55:00 +0100 Subject: [PATCH] Improve memory usage for the config compiler --- lib/config/configitem.cpp | 8 +++----- lib/config/configitem.hpp | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 45cd19ced..8dbde2dcc 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -130,15 +130,13 @@ Dictionary::Ptr ConfigItem::GetProperties(void) locals->Set("__parent", m_Scope); locals->Set("name", m_Name); - DebugHint dhint; m_Properties = make_shared(); m_Properties->Set("type", m_Type); if (!m_Zone.IsEmpty()) m_Properties->Set("zone", m_Zone); m_Properties->Set("__parent", locals); - GetExpressionList()->Evaluate(m_Properties, &dhint); + GetExpressionList()->Evaluate(m_Properties, &m_DebugHints); m_Properties->Remove("__parent"); - m_DebugHints = dhint.ToDictionary(); String name = m_Name; @@ -164,7 +162,7 @@ Dictionary::Ptr ConfigItem::GetProperties(void) return m_Properties; } -Dictionary::Ptr ConfigItem::GetDebugHints(void) const +const DebugHint& ConfigItem::GetDebugHints(void) const { return m_DebugHints; } @@ -309,7 +307,7 @@ void ConfigItem::WriteObjectsFile(const String& filename) persistentItem->Set("type", item->GetType()); persistentItem->Set("name", item->GetName()); persistentItem->Set("properties", item->GetProperties()); - persistentItem->Set("debug_hints", item->GetDebugHints()); + persistentItem->Set("debug_hints", item->GetDebugHints().ToDictionary()); String json = JsonEncode(persistentItem); diff --git a/lib/config/configitem.hpp b/lib/config/configitem.hpp index 7d905247e..0694cb9a7 100644 --- a/lib/config/configitem.hpp +++ b/lib/config/configitem.hpp @@ -49,7 +49,7 @@ public: Expression::Ptr GetExpressionList(void) const; Dictionary::Ptr GetProperties(void); - Dictionary::Ptr GetDebugHints(void) const; + const DebugHint& GetDebugHints(void) const; DynamicObject::Ptr Commit(void); void Register(void); @@ -79,7 +79,7 @@ private: Expression::Ptr m_ExpressionList; Dictionary::Ptr m_Properties; - Dictionary::Ptr m_DebugHints; + DebugHint m_DebugHints; std::vector m_ParentNames; /**< The names of parent configuration items. */ DebugInfo m_DebugInfo; /**< Debug information. */