Convert loop into two algorithms.

This commit is contained in:
Stephen Kelly 2015-01-24 18:07:37 +01:00
parent 8a399c8c9f
commit 7c3f637680
1 changed files with 6 additions and 10 deletions

View File

@ -2299,16 +2299,12 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
{ {
// Now add the rest of the components separated by the proper slash // Now add the rest of the components separated by the proper slash
// direction for this platform. // direction for this platform.
const char* sep = ""; std::vector<std::string>::const_iterator compEnd
for(unsigned int i=1; i < components.size() - 1; ++i) = std::remove(components.begin() + 1, components.end() - 1,
{ std::string());
if(!components[i].empty()) std::vector<std::string>::const_iterator compStart
{ = components.begin() + 1;
result += sep; result += cmJoin(cmRange(compStart, compEnd), slash);
result += components[i];
sep = slash;
}
}
// Only the last component can be empty to avoid double slashes. // Only the last component can be empty to avoid double slashes.
result += slash; result += slash;
result += components.back(); result += components.back();