diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-04-03 17:11:36 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-05-05 18:41:27 +0200 |
commit | a1947aeffe158a0ea7de3ced1bf8d6a4719a27ef (patch) | |
tree | c1b249b7d8bd9b3079df3ad5fe468f7ff4df861b /qmake/option.cpp | |
parent | 412dd857b81471277e1014b6329f46a389a42cb3 (diff) |
Port qmake over to user QRegularExpression
Use the DotMatchesEverythingOption for all places
where we interpret .pro files, to increase compatibility
with QRegExp.
Change-Id: I347d6b17858069f3c9cedcedd04df58358d83f27
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake/option.cpp')
-rw-r--r-- | qmake/option.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp index 9ec2fe6411..2d5ef9dfd6 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -30,7 +30,7 @@ #include "cachekeys.h" #include <ioutils.h> #include <qdir.h> -#include <qregexp.h> +#include <qregularexpression.h> #include <qhash.h> #include <qdebug.h> #include <qlibraryinfo.h> @@ -519,12 +519,14 @@ Option::fixString(QString string, uchar flags) //fix the environment variables if(flags & Option::FixEnvVars) { - int rep; - static QRegExp reg_var("\\$\\(.*\\)"); - reg_var.setMinimal(true); - while((rep = reg_var.indexIn(string)) != -1) - string.replace(rep, reg_var.matchedLength(), - QString::fromLocal8Bit(qgetenv(string.mid(rep + 2, reg_var.matchedLength() - 3).toLatin1().constData()).constData())); + static QRegularExpression reg_var("\\$\\(.*\\)", QRegularExpression::InvertedGreedinessOption); + QRegularExpressionMatch match; + while ((match = reg_var.match(string)).hasMatch()) { + int start = match.capturedStart(); + int len = match.capturedLength(); + string.replace(start, len, + QString::fromLocal8Bit(qgetenv(string.mid(start + 2, len - 3).toLatin1().constData()).constData())); + } } //canonicalize it (and treat as a path) |