Convert loops to cmJoin algorithm with cmRange.

This commit is contained in:
Stephen Kelly 2015-01-25 15:53:20 +01:00
parent bb10012fea
commit 9380e85f86
4 changed files with 5 additions and 34 deletions

View File

@ -259,14 +259,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
{
listString += ";";
}
const char* sep = "";
size_t cc;
for ( cc = 2; cc < args.size(); ++ cc )
{
listString += sep;
listString += args[cc];
sep = ";";
}
listString += cmJoin(cmRange(args).advance(2), ";");
this->Makefile->AddDefinition(listName, listString.c_str());
return true;

View File

@ -3016,13 +3016,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
{
relative += "/";
}
const char* sep = "";
for(unsigned int i=common; i < remote.size(); ++i)
{
relative += sep;
relative += remote[i];
sep = "/";
}
relative += cmJoin(cmRange(remote).advance(common), "/");
// Finally return the path.
return relative;

View File

@ -172,12 +172,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
}
std::vector<std::string>::const_iterator eit
= expandedArgs.begin() + (this->Args.size() - 1);
const char* sep = "";
for( ; eit != expandedArgs.end(); ++eit)
{
argnDef += sep + *eit;
sep = ";";
}
argnDef += cmJoin(cmRange(eit, expandedArgs.end()), ";");
}
argnDefInitialized = true;
}

View File

@ -406,12 +406,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Clock command
else if (args[1] == "time" && args.size() > 2)
{
std::string command = args[2];
for (std::string::size_type cc = 3; cc < args.size(); cc ++)
{
command += " ";
command += args[cc];
}
std::string command = cmJoin(cmRange(args).advance(2), " ");
clock_t clock_start, clock_finish;
time_t time_start, time_finish;
@ -473,14 +468,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
std::string command = "\"";
command += args[3];
command += cmJoin(cmRange(args).advance(3), "\" \"");
command += "\"";
for (std::string::size_type cc = 4; cc < args.size(); cc ++)
{
command += " \"";
command += args[cc];
command += "\"";
}
int retval = 0;
int timeout = 0;
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,