QMakeEvaluator: port a QString::split() to a QStringRef::split() loop

Change-Id: I91a65776124f88a7e2e4778dbe9154b597f52212
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Marc Mutz 2017-04-07 17:07:12 +02:00
parent 18cdf8e90b
commit cdbe9d1483

View File

@ -1455,12 +1455,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
} }
if (args.count() == 1) if (args.count() == 1)
return returnBool(isActiveConfig(args.at(0).toQStringRef())); return returnBool(isActiveConfig(args.at(0).toQStringRef()));
const QStringList &mutuals = args.at(1).toQString(m_tmp2).split(QLatin1Char('|')); const auto mutuals = args.at(1).toQStringRef().split(QLatin1Char('|'));
const ProStringList &configs = values(statics.strCONFIG); const ProStringList &configs = values(statics.strCONFIG);
for (int i = configs.size() - 1; i >= 0; i--) { for (int i = configs.size() - 1; i >= 0; i--) {
for (int mut = 0; mut < mutuals.count(); mut++) { for (int mut = 0; mut < mutuals.count(); mut++) {
if (configs[i] == mutuals[mut].trimmed()) if (configs[i].toQStringRef() == mutuals[mut].trimmed())
return returnBool(configs[i] == args[0]); return returnBool(configs[i] == args[0]);
} }
} }
@ -1489,11 +1489,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
t ^= 1; t ^= 1;
} }
} else { } else {
const QStringList &mutuals = args.at(2).toQString(m_tmp3).split(QLatin1Char('|')); const auto mutuals = args.at(2).toQStringRef().split(QLatin1Char('|'));
for (int i = l.size() - 1; i >= 0; i--) { for (int i = l.size() - 1; i >= 0; i--) {
const ProString val = l[i]; const ProString val = l[i];
for (int mut = 0; mut < mutuals.count(); mut++) { for (int mut = 0; mut < mutuals.count(); mut++) {
if (val == mutuals[mut].trimmed()) { if (val.toQStringRef() == mutuals[mut].trimmed()) {
return returnBool((!regx.isEmpty() return returnBool((!regx.isEmpty()
&& regx.exactMatch(val.toQString(m_tmp2))) && regx.exactMatch(val.toQString(m_tmp2)))
|| val == qry); || val == qry);