From b9f4dd39bb3878ef1fbb0b5b6bc23bab5425584d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Apr 2015 15:59:25 +0200 Subject: [PATCH 1/3] cmDefinitions: Remove unused method. --- Source/cmDefinitions.cxx | 7 ------- Source/cmDefinitions.h | 3 --- 2 files changed, 10 deletions(-) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index fe32dd5d8..6a276596d 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -20,13 +20,6 @@ cmDefinitions::cmDefinitions(cmDefinitions* parent) { } -//---------------------------------------------------------------------------- -void cmDefinitions::Reset(cmDefinitions* parent) -{ - this->Up = parent; - this->Map.clear(); -} - //---------------------------------------------------------------------------- cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key) diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index a2f053fda..ab588eee2 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -30,9 +30,6 @@ public: /** Construct with the given parent scope. */ cmDefinitions(cmDefinitions* parent = 0); - /** Reset object as if newly constructed. */ - void Reset(cmDefinitions* parent = 0); - /** Returns the parent scope, if any. */ cmDefinitions* GetParent() const { return this->Up; } From 23370344427ce8da470ff6266a675150457fdda2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Apr 2015 16:29:54 +0200 Subject: [PATCH 2/3] cmDefinitions: Remove unused Set return value. --- Source/cmDefinitions.cxx | 8 +++----- Source/cmDefinitions.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 6a276596d..d5f6ebc7c 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -45,13 +45,12 @@ cmDefinitions::SetInternal(const std::string& key, Def const& def) if(this->Up || def.Exists) { // In lower scopes we store keys, defined or not. - return (this->Map[key] = def); + this->Map[key] = def; } else { // In the top-most scope we need not store undefined keys. this->Map.erase(key); - return this->NoDef; } } @@ -63,10 +62,9 @@ const char* cmDefinitions::Get(const std::string& key) } //---------------------------------------------------------------------------- -const char* cmDefinitions::Set(const std::string& key, const char* value) +void cmDefinitions::Set(const std::string& key, const char* value) { - Def const& def = this->SetInternal(key, Def(value)); - return def.Exists? def.c_str() : 0; + this->SetInternal(key, Def(value)); } //---------------------------------------------------------------------------- diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index ab588eee2..690df1fae 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -38,7 +38,7 @@ public: const char* Get(const std::string& key); /** Set (or unset if null) a value associated with a key. */ - const char* Set(const std::string& key, const char* value); + void Set(const std::string& key, const char* value); /** Get the set of all local keys. */ std::set LocalKeys() const; From a3358faca1aba179ce6670460f259ab247b44cd4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 26 Apr 2015 11:33:47 +0200 Subject: [PATCH 3/3] cmDefinitions: Inline SetInternal method. --- Source/cmDefinitions.cxx | 24 +++++++++--------------- Source/cmDefinitions.h | 1 - 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index d5f6ebc7c..abb46b333 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -39,9 +39,16 @@ cmDefinitions::GetInternal(const std::string& key) } //---------------------------------------------------------------------------- -cmDefinitions::Def const& -cmDefinitions::SetInternal(const std::string& key, Def const& def) +const char* cmDefinitions::Get(const std::string& key) { + Def const& def = this->GetInternal(key); + return def.Exists? def.c_str() : 0; +} + +//---------------------------------------------------------------------------- +void cmDefinitions::Set(const std::string& key, const char* value) +{ + Def def(value); if(this->Up || def.Exists) { // In lower scopes we store keys, defined or not. @@ -54,19 +61,6 @@ cmDefinitions::SetInternal(const std::string& key, Def const& def) } } -//---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const std::string& key) -{ - Def const& def = this->GetInternal(key); - return def.Exists? def.c_str() : 0; -} - -//---------------------------------------------------------------------------- -void cmDefinitions::Set(const std::string& key, const char* value) -{ - this->SetInternal(key, Def(value)); -} - //---------------------------------------------------------------------------- std::set cmDefinitions::LocalKeys() const { diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 690df1fae..83cd0d9ce 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -78,7 +78,6 @@ private: // Internal query and update methods. Def const& GetInternal(const std::string& key); - Def const& SetInternal(const std::string& key, Def const& def); // Implementation of Closure() method. struct ClosureTag {};