summaryrefslogtreecommitdiffstats
path: root/Source/cmMacroCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-11 21:16:03 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-11 21:58:34 (GMT)
commitb5f98e5012ef53ee6746c42131fc66892bfff717 (patch)
treef99c960e517e50f4e9472c0d4ecdfab61d1dfac9 /Source/cmMacroCommand.cxx
parent83414d5a07753d004f5e663c385ef0c713895d46 (diff)
downloadCMake-b5f98e5012ef53ee6746c42131fc66892bfff717.zip
CMake-b5f98e5012ef53ee6746c42131fc66892bfff717.tar.gz
CMake-b5f98e5012ef53ee6746c42131fc66892bfff717.tar.bz2
cmMacroCommand: Manipulate target string directly.
Avoid copying a string from the source, manipulating it, and then copying it back. Manipulate it in place instead.
Diffstat (limited to 'Source/cmMacroCommand.cxx')
-rw-r--r--Source/cmMacroCommand.cxx24
1 files changed, 10 insertions, 14 deletions
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 49b9fd2..29e8cb1 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -151,37 +151,33 @@ bool cmMacroHelperCommand::InvokeInitialPass
k->FilePath = this->FilePath.c_str();
cmListFileArgument arg;
- if(k->Delim == cmListFileArgument::Bracket)
+ arg.Value = k->Value;
+ if(k->Delim != cmListFileArgument::Bracket)
{
- arg.Value = k->Value;
- }
- else
- {
- std::string tmps = k->Value;
// replace formal arguments
for (unsigned int j = 0; j < variables.size(); ++j)
{
- cmSystemTools::ReplaceString(tmps, variables[j].c_str(),
+ cmSystemTools::ReplaceString(arg.Value, variables[j].c_str(),
expandedArgs[j].c_str());
}
// replace argc
- cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());
+ cmSystemTools::ReplaceString(arg.Value, "${ARGC}",argcDef.c_str());
- cmSystemTools::ReplaceString(tmps, "${ARGN}", expandedArgn.c_str());
- cmSystemTools::ReplaceString(tmps, "${ARGV}", expandedArgv.c_str());
+ cmSystemTools::ReplaceString(arg.Value, "${ARGN}",
+ expandedArgn.c_str());
+ cmSystemTools::ReplaceString(arg.Value, "${ARGV}",
+ expandedArgv.c_str());
// if the current argument of the current function has ${ARGV in it
// then try replacing ARGV values
- if (tmps.find("${ARGV") != std::string::npos)
+ if (arg.Value.find("${ARGV") != std::string::npos)
{
for (unsigned int t = 0; t < expandedArgs.size(); ++t)
{
- cmSystemTools::ReplaceString(tmps, argVs[t].c_str(),
+ cmSystemTools::ReplaceString(arg.Value, argVs[t].c_str(),
expandedArgs[t].c_str());
}
}
-
- arg.Value = tmps;
}
arg.Delim = k->Delim;
arg.FilePath = k->FilePath;