summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-01-25 14:53:20 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-11 21:58:04 (GMT)
commit9380e85f865e29cd5968e91408a31d5160f4a4cb (patch)
treed2ef6fa191ac4d71df76bd621af169b642e07ebc /Source
parentbb10012fea677fd8aa1bbefd06061efcb7ec1955 (diff)
downloadCMake-9380e85f865e29cd5968e91408a31d5160f4a4cb.zip
CMake-9380e85f865e29cd5968e91408a31d5160f4a4cb.tar.gz
CMake-9380e85f865e29cd5968e91408a31d5160f4a4cb.tar.bz2
Convert loops to cmJoin algorithm with cmRange.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmListCommand.cxx9
-rw-r--r--Source/cmLocalGenerator.cxx8
-rw-r--r--Source/cmMacroCommand.cxx7
-rw-r--r--Source/cmcmd.cxx15
4 files changed, 5 insertions, 34 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 8d1657d..dd0cfa9 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -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;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 05d8ab5..35956ad 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -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;
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 676e082..8f6364d 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -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;
}
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 5260cb0..5c93975 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -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,