diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-23 22:59:08 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-01-04 20:35:28 +0000 |
commit | cc2ea22a3050424c0dffe864146af1efc57369b4 (patch) | |
tree | fa0253c35f88b17d0dd7c867e73beb1acc13c56f /src/corelib | |
parent | 73ad2bf32f83a19630ae12845627a33bbb76985d (diff) |
QMimeAllGlobPatterns: optimize string handling in matchingGlobs()
... by not re-creating the same string in every loop iteration.
Change-Id: If17c5980bec8276b531267b309578dac8901c93e
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/mimetypes/qmimeglobpattern.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/mimetypes/qmimeglobpattern.cpp b/src/corelib/mimetypes/qmimeglobpattern.cpp index 4e08f28525..6318295558 100644 --- a/src/corelib/mimetypes/qmimeglobpattern.cpp +++ b/src/corelib/mimetypes/qmimeglobpattern.cpp @@ -213,8 +213,9 @@ QStringList QMimeAllGlobPatterns::matchingGlobs(const QString &fileName, QString // (toLower because fast patterns are always case-insensitive and saved as lowercase) const QStringList matchingMimeTypes = m_fastPatterns.value(simpleExtension); + const QString simplePattern = QLatin1String("*.") + simpleExtension; for (const QString &mime : matchingMimeTypes) - result.addMatch(mime, 50, QLatin1String("*.") + simpleExtension); + result.addMatch(mime, 50, simplePattern); // Can't return yet; *.tar.bz2 has to win over *.bz2, so we need the low-weight mimetypes anyway, // at least those with weight 50. } |