From b84699ae1bf51aeda1e41ca1ae53e83acd82150e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 13 Jul 2014 17:08:31 +0200 Subject: [PATCH] QRegularExpression: make optimize() const Although it may seem strange that such a method is const, optimizing doesn't affect the user-visible part of the object. Moreover, *not* having it const makes it asymmetrical with other methods (such as match()) which are const, and under certain conditions optimize as well. Change-Id: I0cd8d4a6909d00629fcc65c1c3a1f011f31db782 Reviewed-by: Olivier Goffart --- src/corelib/tools/qregularexpression.cpp | 2 +- src/corelib/tools/qregularexpression.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 259cfaba7e..88ce4caea3 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1731,7 +1731,7 @@ QRegularExpressionMatchIterator QRegularExpression::globalMatch(const QString &s \sa QRegularExpression::OptimizeOnFirstUsageOption */ -void QRegularExpression::optimize() +void QRegularExpression::optimize() const { if (!isValid()) // will compile the pattern return; diff --git a/src/corelib/tools/qregularexpression.h b/src/corelib/tools/qregularexpression.h index 3352e2b3d5..ce91eace5f 100644 --- a/src/corelib/tools/qregularexpression.h +++ b/src/corelib/tools/qregularexpression.h @@ -125,7 +125,7 @@ public: MatchType matchType = NormalMatch, MatchOptions matchOptions = NoMatchOption) const; - void optimize(); + void optimize() const; static QString escape(const QString &str);