diff options
Diffstat (limited to 'src/testlib/qbenchmarkvalgrind.cpp')
-rw-r--r-- | src/testlib/qbenchmarkvalgrind.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp index 1de149258d..7d24eb8293 100644 --- a/src/testlib/qbenchmarkvalgrind.cpp +++ b/src/testlib/qbenchmarkvalgrind.cpp @@ -46,6 +46,7 @@ #include <QtCore/qcoreapplication.h> #include <QtCore/qprocess.h> #include <QtCore/qdir.h> +#include <QtCore/qregularexpression.h> #include <QtCore/qset.h> #include <QtTest/private/callgrind_p.h> @@ -90,13 +91,13 @@ qint64 QBenchmarkValgrindUtils::extractResult(const QString &fileName) qint64 val = -1; bool valSeen = false; - QRegExp rxValue(QLatin1String("^summary: (\\d+)")); + QRegularExpression rxValue(QLatin1String("^summary: (\\d+)")); while (!file.atEnd()) { const QString line(QLatin1String(file.readLine())); - if (rxValue.indexIn(line) != -1) { - Q_ASSERT(rxValue.captureCount() == 1); + QRegularExpressionMatch match = rxValue.match(line); + if (match.hasMatch()) { bool ok; - val = rxValue.cap(1).toLongLong(&ok); + val = match.captured(1).toLongLong(&ok); Q_ASSERT(ok); valSeen = true; break; @@ -120,13 +121,12 @@ QString QBenchmarkValgrindUtils::getNewestFileName() int hiSuffix = -1; QFileInfo lastFileInfo; const QString pattern = QString::fromLatin1("%1.(\\d+)").arg(base); - QRegExp rx(pattern); + QRegularExpression rx(pattern); for (const QFileInfo &fileInfo : fiList) { - const int index = rx.indexIn(fileInfo.fileName()); - Q_ASSERT(index == 0); - Q_UNUSED(index); + QRegularExpressionMatch match = rx.match(fileInfo.fileName()); + Q_ASSERT(match.hasMatch()); bool ok; - const int suffix = rx.cap(1).toInt(&ok); + const int suffix = match.captured(1).toInt(&ok); Q_ASSERT(ok); Q_ASSERT(suffix >= 0); if (suffix > hiSuffix) { |