summaryrefslogtreecommitdiffstats
path: root/Source/cmForEachCommand.cxx
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-05-29 04:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-05-29 17:12:22 (GMT)
commit1e805f53f5520d8b13d306331fe1f0b34b5d9d7d (patch)
tree904b39e963db393fa5f982c39639361693d26b6e /Source/cmForEachCommand.cxx
parent1336d11d9ceabf070b75816b91c7ae9459f0817c (diff)
downloadCMake-1e805f53f5520d8b13d306331fe1f0b34b5d9d7d.zip
CMake-1e805f53f5520d8b13d306331fe1f0b34b5d9d7d.tar.gz
CMake-1e805f53f5520d8b13d306331fe1f0b34b5d9d7d.tar.bz2
GetDefinition: avoid duplicate calls
Diffstat (limited to 'Source/cmForEachCommand.cxx')
-rw-r--r--Source/cmForEachCommand.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 32e7892..3b82e0a 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -113,8 +113,8 @@ bool cmForEachFunctionBlocker::ReplayItems(
// At end of for each execute recorded commands
// store the old value
std::string oldDef;
- if (mf.GetDefinition(this->Args.front())) {
- oldDef = mf.GetDefinition(this->Args.front());
+ if (auto d = mf.GetDefinition(this->Args.front())) {
+ oldDef = d;
}
auto restore = false;
@@ -186,8 +186,8 @@ bool cmForEachFunctionBlocker::ReplayZipLists(
// Store old values for iteration variables
std::map<std::string, std::string> oldDefs;
for (auto i = 0u; i < values.size(); ++i) {
- if (mf.GetDefinition(iterationVars[i])) {
- oldDefs.emplace(iterationVars[i], mf.GetDefinition(iterationVars[i]));
+ if (auto d = mf.GetDefinition(iterationVars[i])) {
+ oldDefs.emplace(iterationVars[i], d);
}
}