summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-04-05 10:02:08 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-04-05 10:02:09 +0200
commitbfe5e510b90684d016fb0c68114f85708f7cffda (patch)
tree0ae25857ca1f50bd04ea1b405afcf863b082b012 /tests/auto/other
parent6ada4155aff6a106d918ec1b93923bed9617ab27 (diff)
parent4b4870a12cd920cd45c534deae7ca90716398a19 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index 4e0cb3b835..074644393d 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -192,7 +192,7 @@ QList<QPair<QString,QStringList> > PaintCommands::s_enumsTable = QList<QPair<QSt
QMultiHash<QString, int> PaintCommands::s_commandHash;
#define DECL_PAINTCOMMAND(identifier, method, regexp, syntax, sample) \
- s_commandInfoTable << PaintCommandInfos(QLatin1String(identifier), &PaintCommands::method, QRegularExpression(regexp, QRegularExpression::OptimizeOnFirstUsageOption), \
+ s_commandInfoTable << PaintCommandInfos(QLatin1String(identifier), &PaintCommands::method, QRegularExpression(regexp), \
QLatin1String(syntax), QLatin1String(sample) );
#define DECL_PAINTCOMMANDSECTION(title) \
@@ -615,6 +615,8 @@ void PaintCommands::staticInit()
// populate the command lookup hash
for (int i=0; i<s_commandInfoTable.size(); i++) {
+ // and pre-optimize the regexps.
+ s_commandInfoTable.at(i).regExp.optimize();
if (s_commandInfoTable.at(i).isSectionHeader() ||
s_commandInfoTable.at(i).identifier == QLatin1String("comment") ||
s_commandInfoTable.at(i).identifier == QLatin1String("noop"))
@@ -682,6 +684,7 @@ void PaintCommands::insertAt(int commandIndex, const QStringList &newCommands)
**********************************************************************************/
void PaintCommands::runCommand(const QString &scriptLine)
{
+ static QRegularExpression separators("\\s");
if (scriptLine.isEmpty()) {
command_noop(QRegularExpressionMatch());
return;
@@ -690,7 +693,7 @@ void PaintCommands::runCommand(const QString &scriptLine)
command_comment(QRegularExpressionMatch());
return;
}
- QString firstWord = scriptLine.section(QRegularExpression("\\s"), 0, 0);
+ QString firstWord = scriptLine.section(separators, 0, 0);
QList<int> indices = s_commandHash.values(firstWord);
foreach(int idx, indices) {
PaintCommandInfos command = s_commandInfoTable.at(idx);