summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2021-08-03 14:14:04 (GMT)
committerBrad King <brad.king@kitware.com>2021-08-03 14:55:47 (GMT)
commit54a70b3988d756cccf92773d86b38e3b2574758c (patch)
tree556ae6d724b4c773c4fe954198050d3f257ba0f4 /Source
parentf37d6a31703bd74dddfbc82b41f3d97633edb70b (diff)
downloadCMake-54a70b3988d756cccf92773d86b38e3b2574758c.zip
CMake-54a70b3988d756cccf92773d86b38e3b2574758c.tar.gz
CMake-54a70b3988d756cccf92773d86b38e3b2574758c.tar.bz2
Refactor: Move version compare op table out of the function
It's static data and never changed.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmConditionEvaluator.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 9485d04..415f667 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -59,6 +59,12 @@ auto const keyVERSION_GREATER_EQUAL = "VERSION_GREATER_EQUAL"_s;
auto const keyVERSION_LESS = "VERSION_LESS"_s;
auto const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL"_s;
+cmSystemTools::CompareOp const MATCH2CMPOP[5] = {
+ cmSystemTools::OP_LESS, cmSystemTools::OP_LESS_EQUAL,
+ cmSystemTools::OP_GREATER, cmSystemTools::OP_GREATER_EQUAL,
+ cmSystemTools::OP_EQUAL
+};
+
// Run-Time to Compile-Time template selector
template <template <typename> class Comp, template <typename> class... Ops>
struct cmRt2CtSelector
@@ -716,13 +722,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
this->matchKeys(*args.next, keyVERSION_LESS,
keyVERSION_LESS_EQUAL, keyVERSION_GREATER,
keyVERSION_GREATER_EQUAL, keyVERSION_EQUAL))) {
-
- const cmSystemTools::CompareOp xlat[5] = {
- cmSystemTools::OP_LESS, cmSystemTools::OP_LESS_EQUAL,
- cmSystemTools::OP_GREATER, cmSystemTools::OP_GREATER_EQUAL,
- cmSystemTools::OP_EQUAL
- };
- const auto op = xlat[matchNo - 1];
+ const auto op = MATCH2CMPOP[matchNo - 1];
const cmProp lhs = this->GetVariableOrString(*args.current);
const cmProp rhs = this->GetVariableOrString(*args.nextnext);
const auto result =