cmListCommand: Use cmRemoveIndices for REMOVE_AT subcommand.
Avoid repeatedly looping over the indices to process elements (even without breaking out of the loop when the element is found).
This commit is contained in:
parent
0b5cf0dabd
commit
6a22e40147
@ -527,26 +527,19 @@ bool cmListCommand::HandleRemoveAtCommand(
|
|||||||
removed.push_back(static_cast<size_t>(item));
|
removed.push_back(static_cast<size_t>(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::sort(removed.begin(), removed.end());
|
||||||
|
removed.erase(std::unique(removed.begin(), removed.end()), removed.end());
|
||||||
|
|
||||||
|
varArgsExpanded.erase(cmRemoveIndices(varArgsExpanded, removed),
|
||||||
|
varArgsExpanded.end());
|
||||||
|
|
||||||
std::string value;
|
std::string value;
|
||||||
const char* sep = "";
|
const char* sep = "";
|
||||||
for ( cc = 0; cc < varArgsExpanded.size(); ++ cc )
|
for ( cc = 0; cc < varArgsExpanded.size(); ++ cc )
|
||||||
{
|
{
|
||||||
size_t kk;
|
value += sep;
|
||||||
bool found = false;
|
value += varArgsExpanded[cc];
|
||||||
for ( kk = 0; kk < removed.size(); ++ kk )
|
sep = ";";
|
||||||
{
|
|
||||||
if ( cc == removed[kk] )
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !found )
|
|
||||||
{
|
|
||||||
value += sep;
|
|
||||||
value += varArgsExpanded[cc];
|
|
||||||
sep = ";";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Makefile->AddDefinition(listName, value.c_str());
|
this->Makefile->AddDefinition(listName, value.c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user