summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-11 19:16:40 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-11 21:58:34 (GMT)
commit83414d5a07753d004f5e663c385ef0c713895d46 (patch)
tree736dfdf75911e62274ca381e380973ab925edf78
parent9a1f8f35f48d7dcfefc70de9ae530c31b16cd9e0 (diff)
downloadCMake-83414d5a07753d004f5e663c385ef0c713895d46.zip
CMake-83414d5a07753d004f5e663c385ef0c713895d46.tar.gz
CMake-83414d5a07753d004f5e663c385ef0c713895d46.tar.bz2
cmMacroCommand: Move computation of ARGV%n names out of double loop.
-rw-r--r--Source/cmMacroCommand.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 44b1465..49b9fd2 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -117,6 +117,14 @@ bool cmMacroHelperCommand::InvokeInitialPass
{
variables.push_back("${" + this->Args[j] + "}");
}
+ std::vector<std::string> argVs;
+ argVs.reserve(expandedArgs.size());
+ char argvName[60];
+ for (unsigned int j = 0; j < expandedArgs.size(); ++j)
+ {
+ sprintf(argvName,"${ARGV%i}",j);
+ argVs.push_back(argvName);
+ }
if(!this->Functions.empty())
{
this->FilePath = this->Functions[0].FilePath;
@@ -166,12 +174,9 @@ bool cmMacroHelperCommand::InvokeInitialPass
// then try replacing ARGV values
if (tmps.find("${ARGV") != std::string::npos)
{
- char argvName[60];
- // also replace the ARGV1 ARGV2 ... etc
for (unsigned int t = 0; t < expandedArgs.size(); ++t)
{
- sprintf(argvName,"${ARGV%i}",t);
- cmSystemTools::ReplaceString(tmps, argvName,
+ cmSystemTools::ReplaceString(tmps, argVs[t].c_str(),
expandedArgs[t].c_str());
}
}