From 840e787175f0cec4714c3941c99c045a9717910d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 23 Nov 2016 10:10:55 +0100 Subject: Use QString::splitRef() instead of QString::split() Avoid string allocation where it seems feasible. Change-Id: I61b23d4ef8a459f5aa77727a75f4e1d2b140da3b Reviewed-by: Tobias Hunger --- src/plugins/coreplugin/documentmanager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/coreplugin/documentmanager.cpp') diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index ef5ab7b776..9cf6a25a71 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -703,14 +703,14 @@ QString DocumentManager::getSaveFileName(const QString &title, const QString &pa const int index = regExp.lastIndexIn(*selectedFilter); if (index != -1) { bool suffixOk = false; - const QStringList &suffixes = regExp.cap(1).remove(QLatin1Char('*')).split(QLatin1Char(' ')); - foreach (const QString &suffix, suffixes) + const QVector suffixes = regExp.cap(1).remove(QLatin1Char('*')).splitRef(QLatin1Char(' ')); + foreach (const QStringRef &suffix, suffixes) if (fileName.endsWith(suffix)) { suffixOk = true; break; } if (!suffixOk && !suffixes.isEmpty()) - fileName.append(suffixes.at(0)); + fileName.append(suffixes.at(0).toString()); } } if (QFile::exists(fileName)) { -- cgit v1.2.1