diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2018-07-20 21:55:48 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2018-08-03 18:02:14 +0000 |
commit | 1a4a2f7f5826b37843380f3b629ecbaadf45c0f0 (patch) | |
tree | 5faa8fff939de297f3f1f42fe28aaf68d552e4ce /src/corelib/global/qlogging.cpp | |
parent | 4b7cb3bc91e100c591134c1c32c397477356d2eb (diff) |
QLogging: make QRegularExpression objects static const
To avoid recompiling them multiple times.
Change-Id: Ie4766be3bbaa536bf22b0eaacc430055fe4651cd
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index c9326e7366..308ebe7a68 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1211,8 +1211,8 @@ void QMessagePattern::setPattern(const QString &pattern) tokens[i] = backtraceTokenC; QString backtraceSeparator = QStringLiteral("|"); int backtraceDepth = 5; - QRegularExpression depthRx(QStringLiteral(" depth=(?|\"([^\"]*)\"|([^ }]*))")); - QRegularExpression separatorRx(QStringLiteral(" separator=(?|\"([^\"]*)\"|([^ }]*))")); + static const QRegularExpression depthRx(QStringLiteral(" depth=(?|\"([^\"]*)\"|([^ }]*))")); + static const QRegularExpression separatorRx(QStringLiteral(" separator=(?|\"([^\"]*)\"|([^ }]*))")); QRegularExpressionMatch m = depthRx.match(lexeme); if (m.hasMatch()) { int depth = m.capturedRef(1).toInt(); @@ -1298,7 +1298,7 @@ static QStringList backtraceFramesForLogMessage(int frameCount) // The offset and function name are optional. // This regexp tries to extract the library name (without the path) and the function name. // This code is protected by QMessagePattern::mutex so it is thread safe on all compilers - static QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$")); + static const QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$")); QVarLengthArray<void*, 32> buffer(8 + frameCount); int n = backtrace(buffer.data(), buffer.size()); |