summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-04-13 18:48:48 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-04-13 19:10:19 (GMT)
commit1e738bcf9c7952bc9ae9bfb1be831c9f16998f54 (patch)
treef98247eeab61418aeb987c57914ae7cb5c507de1 /Source/cmake.cxx
parent62854e9966a3fe308cff4a76c89f6bf72f76551c (diff)
downloadCMake-1e738bcf9c7952bc9ae9bfb1be831c9f16998f54.zip
CMake-1e738bcf9c7952bc9ae9bfb1be831c9f16998f54.tar.gz
CMake-1e738bcf9c7952bc9ae9bfb1be831c9f16998f54.tar.bz2
cmake: Simplify RemoveUnscriptableCommands algorithm.
Remove obsolete RemoveCommand method.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx30
1 files changed, 8 insertions, 22 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 0dcf9be..b852e00 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -261,17 +261,6 @@ void cmake::RenameCommand(const std::string& oldName,
this->Commands.erase(pos);
}
-void cmake::RemoveCommand(const std::string& name)
-{
- std::string sName = cmSystemTools::LowerCase(name);
- RegisteredCommandsMap::iterator pos = this->Commands.find(sName);
- if ( pos != this->Commands.end() )
- {
- delete pos->second;
- this->Commands.erase(pos);
- }
-}
-
void cmake::AddCommand(cmCommand* command)
{
std::string name = cmSystemTools::LowerCase(command->GetName());
@@ -289,22 +278,19 @@ void cmake::AddCommand(cmCommand* command)
void cmake::RemoveUnscriptableCommands()
{
std::vector<std::string> unscriptableCommands;
- for (cmake::RegisteredCommandsMap::const_iterator
+ for (cmake::RegisteredCommandsMap::iterator
pos = this->Commands.begin();
- pos != this->Commands.end();
- ++pos)
+ pos != this->Commands.end(); )
{
if (!pos->second->IsScriptable())
{
- unscriptableCommands.push_back(pos->first);
+ delete pos->second;
+ this->Commands.erase(pos++);
+ }
+ else
+ {
+ ++pos;
}
- }
-
- for(std::vector<std::string>::const_iterator it=unscriptableCommands.begin();
- it != unscriptableCommands.end();
- ++it)
- {
- this->RemoveCommand(*it);
}
}