From 681d965df18fa55a9eaa615515015ac088ea0805 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 4 Jan 2015 15:06:37 +0100 Subject: [PATCH] Use the cmDeleteAll algorithm for types derived from std::map. --- Source/cmExportSetMap.cxx | 7 +------ Source/cmGlobalGenerator.cxx | 6 +----- Source/cmTarget.cxx | 12 ++---------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx index 517411887..14c445891 100644 --- a/Source/cmExportSetMap.cxx +++ b/Source/cmExportSetMap.cxx @@ -25,12 +25,7 @@ cmExportSet* cmExportSetMap::operator[](const std::string &name) void cmExportSetMap::clear() { - for(std::map::iterator it = this->begin(); - it != this->end(); - ++ it) - { - delete it->second; - } + cmDeleteAll(*this); this->derived::clear(); } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d17710ed6..f282badd6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1510,11 +1510,7 @@ void cmGlobalGenerator::CreateGeneratorTargets() //---------------------------------------------------------------------------- void cmGlobalGenerator::ClearGeneratorMembers() { - for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); - i != this->GeneratorTargets.end(); ++i) - { - delete i->second; - } + cmDeleteAll(this->GeneratorTargets); this->GeneratorTargets.clear(); cmDeleteAll(this->EvaluationFiles); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8e060c474..8d0271a36 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -539,12 +539,7 @@ void cmTarget::ClearLinkMaps() this->Internal->LinkInterfaceUsageRequirementsOnlyMap.clear(); this->Internal->LinkClosureMap.clear(); this->Internal->SourceFilesMap.clear(); - for (cmTargetLinkInformationMap::const_iterator it - = this->LinkInformation.begin(); - it != this->LinkInformation.end(); ++it) - { - delete it->second; - } + cmDeleteAll(this->LinkInformation); this->LinkInformation.clear(); } @@ -6874,10 +6869,7 @@ cmTargetLinkInformationMap //---------------------------------------------------------------------------- cmTargetLinkInformationMap::~cmTargetLinkInformationMap() { - for(derived::iterator i = this->begin(); i != this->end(); ++i) - { - delete i->second; - } + cmDeleteAll(*this); } //----------------------------------------------------------------------------