QLogging: make QRegularExpression objects static const
To avoid recompiling them multiple times. Change-Id: Ie4766be3bbaa536bf22b0eaacc430055fe4651cd Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
This commit is contained in:
parent
4b7cb3bc91
commit
1a4a2f7f58
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user