diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-11 14:55:37 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-09-14 13:49:36 +0000 |
commit | f8954106d926d4786b4c36e172fae25e97c1bdf7 (patch) | |
tree | c6b73514243ccfda04e90de090aebab422b3deb9 /src/linguist/shared/qmakebuiltins.cpp | |
parent | a0efbd756f56e85f43c5ba2eb3019619382e9b68 (diff) |
qmake: fix raw data detach avoidance
the m_tmp array is a member, so the index toggle for accessing it also
needs to be one - otherwise, odd iteration counts will defeat the
mechanism.
Change-Id: If7a800ed5a4b4168625daf1ebbd5d2d164569d8e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from qtbase/ccb8afcda752093bfb6bc32f560131a91bd826a1)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/linguist/shared/qmakebuiltins.cpp')
-rw-r--r-- | src/linguist/shared/qmakebuiltins.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/linguist/shared/qmakebuiltins.cpp b/src/linguist/shared/qmakebuiltins.cpp index d51dcbcfe..f5f77262a 100644 --- a/src/linguist/shared/qmakebuiltins.cpp +++ b/src/linguist/shared/qmakebuiltins.cpp @@ -888,12 +888,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( evalError(fL1S("find(var, str) requires two arguments.")); } else { QRegExp regx(args.at(1).toQString()); - int t = 0; const auto vals = values(map(args.at(0))); for (const ProString &val : vals) { - if (regx.indexIn(val.toQString(m_tmp[t])) != -1) + if (regx.indexIn(val.toQString(m_tmp[m_toggle ^= 1])) != -1) ret += val; - t ^= 1; } } break; @@ -1391,12 +1389,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( copy.detach(); regx.setPattern(copy); } - int t = 0; const auto strings = vars.value(map(args.at(1))); for (const ProString &s : strings) { - if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[t]))) || s == qry) + if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[m_toggle ^= 1]))) || s == qry) return ReturnTrue; - t ^= 1; } } return ReturnFalse; @@ -1461,12 +1457,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } const ProStringList &l = values(map(args.at(0))); if (args.count() == 2) { - int t = 0; for (int i = 0; i < l.size(); ++i) { const ProString &val = l[i]; - if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[t]))) || val == qry) + if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[m_toggle ^= 1]))) || val == qry) return ReturnTrue; - t ^= 1; } } else { const auto mutuals = args.at(2).toQStringRef().split(QLatin1Char('|')); |