Use the cmDeleteAll algorithm instead of trivial raw loops.
This commit is contained in:
parent
abb4a6781f
commit
4a6e795b0c
|
@ -158,11 +158,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
|
|||
//----------------------------------------------------------------------
|
||||
cmCPackGeneratorFactory::~cmCPackGeneratorFactory()
|
||||
{
|
||||
std::vector<cmCPackGenerator*>::iterator it;
|
||||
for ( it = this->Generators.begin(); it != this->Generators.end(); ++ it )
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
cmDeleteAll(this->Generators);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -69,11 +69,7 @@ cmCursesMainForm::~cmCursesMainForm()
|
|||
// Clean-up composites
|
||||
if (this->Entries)
|
||||
{
|
||||
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
cmDeleteAll(*this->Entries);
|
||||
}
|
||||
delete this->Entries;
|
||||
if (this->CMakeInstance)
|
||||
|
@ -188,12 +184,7 @@ void cmCursesMainForm::InitializeUI()
|
|||
// Clean old entries
|
||||
if (this->Entries)
|
||||
{
|
||||
// Have to call delete on each pointer
|
||||
std::vector<cmCursesCacheEntryComposite*>::iterator it;
|
||||
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
cmDeleteAll(*this->Entries);
|
||||
}
|
||||
delete this->Entries;
|
||||
this->Entries = newEntries;
|
||||
|
|
|
@ -378,13 +378,7 @@ cmCTest::cmCTest()
|
|||
//----------------------------------------------------------------------
|
||||
cmCTest::~cmCTest()
|
||||
{
|
||||
cmCTest::t_TestingHandlers::iterator it;
|
||||
for ( it = this->TestingHandlers.begin();
|
||||
it != this->TestingHandlers.end(); ++ it )
|
||||
{
|
||||
delete it->second;
|
||||
it->second = 0;
|
||||
}
|
||||
cmDeleteAll(this->TestingHandlers);
|
||||
this->SetOutputLogFileName(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -200,12 +200,7 @@ cmComputeLinkDepends
|
|||
//----------------------------------------------------------------------------
|
||||
cmComputeLinkDepends::~cmComputeLinkDepends()
|
||||
{
|
||||
for(std::vector<DependSetList*>::iterator
|
||||
i = this->InferredDependSets.begin();
|
||||
i != this->InferredDependSets.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
cmDeleteAll(this->InferredDependSets);
|
||||
delete this->CCG;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,12 +90,7 @@ cmDependsC::cmDependsC(cmLocalGenerator* lg,
|
|||
cmDependsC::~cmDependsC()
|
||||
{
|
||||
this->WriteCacheFile();
|
||||
|
||||
for (std::map<std::string, cmIncludeLines*>::iterator it=
|
||||
this->FileCache.begin(); it!=this->FileCache.end(); ++it)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
cmDeleteAll(this->FileCache);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -87,12 +87,7 @@ cmDocumentation::cmDocumentation()
|
|||
//----------------------------------------------------------------------------
|
||||
cmDocumentation::~cmDocumentation()
|
||||
{
|
||||
for(std::map<std::string,cmDocumentationSection *>::iterator i =
|
||||
this->AllSections.begin();
|
||||
i != this->AllSections.end(); ++i)
|
||||
{
|
||||
delete i->second;
|
||||
}
|
||||
cmDeleteAll(this->AllSections);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -15,10 +15,7 @@
|
|||
|
||||
cmExportSet::~cmExportSet()
|
||||
{
|
||||
for(unsigned int i = 0; i < this->TargetExports.size(); ++ i)
|
||||
{
|
||||
delete this->TargetExports[i];
|
||||
}
|
||||
cmDeleteAll(this->TargetExports);
|
||||
}
|
||||
|
||||
void cmExportSet::AddTargetExport(cmTargetExport* te)
|
||||
|
|
|
@ -23,16 +23,8 @@ cmFileLockPool::cmFileLockPool()
|
|||
|
||||
cmFileLockPool::~cmFileLockPool()
|
||||
{
|
||||
for (It i = this->FunctionScopes.begin();
|
||||
i != this->FunctionScopes.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
|
||||
for (It i = this->FileScopes.begin(); i != this->FileScopes.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
cmDeleteAll(this->FunctionScopes);
|
||||
cmDeleteAll(this->FileScopes);
|
||||
}
|
||||
|
||||
void cmFileLockPool::PushFunctionScope()
|
||||
|
@ -148,10 +140,7 @@ cmFileLockPool::ScopePool::ScopePool()
|
|||
|
||||
cmFileLockPool::ScopePool::~ScopePool()
|
||||
{
|
||||
for (It i = this->Locks.begin(); i != this->Locks.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
cmDeleteAll(this->Locks);
|
||||
}
|
||||
|
||||
cmFileLockResult cmFileLockPool::ScopePool::Lock(
|
||||
|
|
|
@ -150,15 +150,7 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
|
|||
//----------------------------------------------------------------------------
|
||||
cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
|
||||
{
|
||||
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
|
||||
= this->Evaluators.begin();
|
||||
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
|
||||
= this->Evaluators.end();
|
||||
|
||||
for ( ; it != end; ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
cmDeleteAll(this->Evaluators);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -1517,27 +1517,13 @@ void cmGlobalGenerator::ClearGeneratorMembers()
|
|||
}
|
||||
this->GeneratorTargets.clear();
|
||||
|
||||
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
|
||||
li = this->EvaluationFiles.begin();
|
||||
li != this->EvaluationFiles.end();
|
||||
++li)
|
||||
{
|
||||
delete *li;
|
||||
}
|
||||
cmDeleteAll(this->EvaluationFiles);
|
||||
this->EvaluationFiles.clear();
|
||||
|
||||
for(std::map<std::string, cmExportBuildFileGenerator*>::iterator
|
||||
i = this->BuildExportSets.begin();
|
||||
i != this->BuildExportSets.end(); ++i)
|
||||
{
|
||||
delete i->second;
|
||||
}
|
||||
cmDeleteAll(this->BuildExportSets);
|
||||
this->BuildExportSets.clear();
|
||||
|
||||
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
||||
{
|
||||
delete this->LocalGenerators[i];
|
||||
}
|
||||
cmDeleteAll(this->LocalGenerators);
|
||||
this->LocalGenerators.clear();
|
||||
|
||||
this->ExportSets.clear();
|
||||
|
|
|
@ -38,11 +38,7 @@ public:
|
|||
|
||||
~Property()
|
||||
{
|
||||
for(ExpressionVectorType::iterator i = ValueExpressions.begin();
|
||||
i != ValueExpressions.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
cmDeleteAll(this->ValueExpressions);
|
||||
}
|
||||
|
||||
ExpressionVectorType ValueExpressions;
|
||||
|
|
|
@ -34,12 +34,7 @@ cmMakeDepend::cmMakeDepend()
|
|||
|
||||
cmMakeDepend::~cmMakeDepend()
|
||||
{
|
||||
for(DependInformationMapType::iterator i =
|
||||
this->DependInformationMap.begin();
|
||||
i != this->DependInformationMap.end(); ++i)
|
||||
{
|
||||
delete i->second;
|
||||
}
|
||||
cmDeleteAll(this->DependInformationMap);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -194,45 +194,13 @@ bool cmMakefile::NeedCacheCompatibility(int major, int minor) const
|
|||
|
||||
cmMakefile::~cmMakefile()
|
||||
{
|
||||
for(std::vector<cmInstallGenerator*>::iterator
|
||||
i = this->InstallGenerators.begin();
|
||||
i != this->InstallGenerators.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
for(std::vector<cmTestGenerator*>::iterator
|
||||
i = this->TestGenerators.begin();
|
||||
i != this->TestGenerators.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
for(std::vector<cmSourceFile*>::iterator i = this->SourceFiles.begin();
|
||||
i != this->SourceFiles.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
for(std::map<std::string, cmTest*>::iterator i = this->Tests.begin();
|
||||
i != this->Tests.end(); ++i)
|
||||
{
|
||||
delete i->second;
|
||||
}
|
||||
for(std::vector<cmTarget*>::iterator
|
||||
i = this->ImportedTargetsOwned.begin();
|
||||
i != this->ImportedTargetsOwned.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
for(unsigned int i=0; i < this->FinalPassCommands.size(); i++)
|
||||
{
|
||||
delete this->FinalPassCommands[i];
|
||||
}
|
||||
std::vector<cmFunctionBlocker*>::iterator pos;
|
||||
for (pos = this->FunctionBlockers.begin();
|
||||
pos != this->FunctionBlockers.end(); ++pos)
|
||||
{
|
||||
cmFunctionBlocker* b = *pos;
|
||||
delete b;
|
||||
}
|
||||
cmDeleteAll(this->InstallGenerators);
|
||||
cmDeleteAll(this->TestGenerators);
|
||||
cmDeleteAll(this->SourceFiles);
|
||||
cmDeleteAll(this->Tests);
|
||||
cmDeleteAll(this->ImportedTargetsOwned);
|
||||
cmDeleteAll(this->FinalPassCommands);
|
||||
cmDeleteAll(this->FunctionBlockers);
|
||||
this->FunctionBlockers.clear();
|
||||
if (this->PolicyStack.size() != 1)
|
||||
{
|
||||
|
|
|
@ -291,18 +291,8 @@ cmOrderDirectories::cmOrderDirectories(cmGlobalGenerator* gg,
|
|||
//----------------------------------------------------------------------------
|
||||
cmOrderDirectories::~cmOrderDirectories()
|
||||
{
|
||||
for(std::vector<cmOrderDirectoriesConstraint*>::iterator
|
||||
i = this->ConstraintEntries.begin();
|
||||
i != this->ConstraintEntries.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
for(std::vector<cmOrderDirectoriesConstraint*>::iterator
|
||||
i = this->ImplicitDirEntries.begin();
|
||||
i != this->ImplicitDirEntries.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
cmDeleteAll(this->ConstraintEntries);
|
||||
cmDeleteAll(this->ImplicitDirEntries);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -378,13 +378,7 @@ cmPolicies::cmPolicies()
|
|||
|
||||
cmPolicies::~cmPolicies()
|
||||
{
|
||||
// free the policies
|
||||
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
|
||||
= this->Policies.begin();
|
||||
for (;i != this->Policies.end(); ++i)
|
||||
{
|
||||
delete i->second;
|
||||
}
|
||||
cmDeleteAll(this->Policies);
|
||||
}
|
||||
|
||||
void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
|
||||
|
|
|
@ -226,13 +226,7 @@ cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem;
|
|||
static void deleteAndClear(
|
||||
std::vector<cmTargetInternals::TargetPropertyEntry*> &entries)
|
||||
{
|
||||
for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
|
||||
it = entries.begin(),
|
||||
end = entries.end();
|
||||
it != end; ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
cmDeleteAll(entries);
|
||||
entries.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -171,16 +171,8 @@ cmake::~cmake()
|
|||
delete this->GlobalGenerator;
|
||||
this->GlobalGenerator = 0;
|
||||
}
|
||||
for(RegisteredCommandsMap::iterator j = this->Commands.begin();
|
||||
j != this->Commands.end(); ++j)
|
||||
{
|
||||
delete (*j).second;
|
||||
}
|
||||
for(RegisteredGeneratorsVector::iterator j = this->Generators.begin();
|
||||
j != this->Generators.end(); ++j)
|
||||
{
|
||||
delete *j;
|
||||
}
|
||||
cmDeleteAll(this->Commands);
|
||||
cmDeleteAll(this->Generators);
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
delete this->VariableWatch;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue