Do not anchor an already-anchored regexp

wildcardToRegularExpression() returns an anchored regexp, so it is
pointless to anchor it again.

Change-Id: If470179d63ae7ca2e7f137c0f403ec5bb5be8aaf
Task-number: QTBUG-81396
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Giuseppe D'Angelo 2020-01-15 23:00:58 +01:00
parent 6faaef5a66
commit 800dda19a6

View File

@ -181,7 +181,7 @@ QDirIteratorPrivate::QDirIteratorPrivate(const QFileSystemEntry &entry, const QS
#elif QT_CONFIG(regularexpression)
nameRegExps.reserve(nameFilters.size());
for (const auto &filter : nameFilters) {
QString re = QRegularExpression::anchoredPattern(QRegularExpression::wildcardToRegularExpression(filter));
QString re = QRegularExpression::wildcardToRegularExpression(filter);
nameRegExps.append(
QRegularExpression(re, (filters & QDir::CaseSensitive) ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption));
}