summaryrefslogtreecommitdiffstats
path: root/Source/cmCPluginAPI.cxx
diff options
context:
space:
mode:
authorOleksandr Koval <oleksandr.koval.dev@gmail.com>2020-10-01 11:28:03 (GMT)
committerOleksandr Koval <oleksandr.koval.dev@gmail.com>2020-10-01 11:28:03 (GMT)
commite614528ad1e7d053169535cc32fe566f6eb22d41 (patch)
treefc81ab6b79afc387519d5b97d088ef99a0454567 /Source/cmCPluginAPI.cxx
parent47b569a85852f716b05ede538e9940392407316c (diff)
downloadCMake-e614528ad1e7d053169535cc32fe566f6eb22d41.zip
CMake-e614528ad1e7d053169535cc32fe566f6eb22d41.tar.gz
CMake-e614528ad1e7d053169535cc32fe566f6eb22d41.tar.bz2
cmListFileCache: Make cmListFileFunction a shared pointer
Passing cmListFileFunction everywhere by-value involves big overhead. Now cmListFileFunction stores std::shared_ptr to the underlying data.
Diffstat (limited to 'Source/cmCPluginAPI.cxx')
-rw-r--r--Source/cmCPluginAPI.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index ee2960b..8ebf6d2 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -419,12 +419,15 @@ int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
const char** args)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
- cmListFileFunction lff;
- lff.Name = name;
+
+ std::vector<cmListFileArgument> lffArgs;
+ lffArgs.reserve(numArgs);
for (int i = 0; i < numArgs; ++i) {
// Assume all arguments are quoted.
- lff.Arguments.emplace_back(args[i], cmListFileArgument::Quoted, 0);
+ lffArgs.emplace_back(args[i], cmListFileArgument::Quoted, 0);
}
+
+ cmListFileFunction lff{ name, 0, std::move(lffArgs) };
cmExecutionStatus status(*mf);
return mf->ExecuteCommand(lff, status);
}