diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2019-12-18 16:50:42 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2019-12-19 10:15:13 (GMT) |
commit | 23130c539fc6ae1f4809e4c639a1a15a5f299c48 (patch) | |
tree | 85a44df91cf1e462d0d0616c63ad0ff5d9112223 | |
parent | 3c632b89abf7edd2d82f21dc31d0a933775d8b85 (diff) | |
download | CMake-23130c539fc6ae1f4809e4c639a1a15a5f299c48.zip CMake-23130c539fc6ae1f4809e4c639a1a15a5f299c48.tar.gz CMake-23130c539fc6ae1f4809e4c639a1a15a5f299c48.tar.bz2 |
cmInstalledFile: modernize memory management
-rw-r--r-- | Source/cmInstalledFile.cxx | 17 | ||||
-rw-r--r-- | Source/cmInstalledFile.h | 4 |
2 files changed, 7 insertions, 14 deletions
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index eabe590..a65ae03 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -4,7 +4,6 @@ #include <utility> -#include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmListFileCache.h" #include "cmMakefile.h" @@ -12,17 +11,11 @@ cmInstalledFile::cmInstalledFile() = default; -cmInstalledFile::~cmInstalledFile() -{ - delete NameExpression; -} +cmInstalledFile::~cmInstalledFile() = default; cmInstalledFile::Property::Property() = default; -cmInstalledFile::Property::~Property() -{ - cmDeleteAll(this->ValueExpressions); -} +cmInstalledFile::Property::~Property() = default; void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) { @@ -30,7 +23,7 @@ void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) cmGeneratorExpression ge(backtrace); this->Name = name; - this->NameExpression = ge.Parse(name).release(); + this->NameExpression = ge.Parse(name); } std::string const& cmInstalledFile::GetName() const @@ -63,7 +56,7 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf, cmGeneratorExpression ge(backtrace); Property& property = this->Properties[prop]; - property.ValueExpressions.push_back(ge.Parse(value).release()); + property.ValueExpressions.push_back(ge.Parse(value)); } bool cmInstalledFile::HasProperty(const std::string& prop) const @@ -84,7 +77,7 @@ bool cmInstalledFile::GetProperty(const std::string& prop, std::string output; std::string separator; - for (auto ve : property.ValueExpressions) { + for (const auto& ve : property.ValueExpressions) { output += separator; output += ve->GetInput(); separator = ";"; diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index ee809ee..698151e 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -24,7 +24,7 @@ public: using CompiledGeneratorExpressionPtrType = std::unique_ptr<cmCompiledGeneratorExpression>; - using ExpressionVectorType = std::vector<cmCompiledGeneratorExpression*>; + using ExpressionVectorType = std::vector<CompiledGeneratorExpressionPtrType>; struct Property { @@ -73,7 +73,7 @@ public: private: std::string Name; - cmCompiledGeneratorExpression* NameExpression = nullptr; + CompiledGeneratorExpressionPtrType NameExpression; PropertyMapType Properties; }; |