diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-07-05 16:30:13 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-07-05 18:58:27 +0000 |
commit | 3a33ee78c9329d772b4794d094bc48444514c101 (patch) | |
tree | c3f203c3f4a5ec9805e6f66026e6fe4d94b1493d /src/tools | |
parent | 5392259ce6df9b9852a8580831cff4139fe2677c (diff) | |
download | qtbase-3a33ee78c9329d772b4794d094bc48444514c101.tar.gz |
Tools: replace QString::trimmed() with QStringRef::trimmed()
... where it's possible. Reduce allocations.
Change-Id: I9908d9d65177d116a8a54146274a74edb801543e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/uic/cpp/cppwriteincludes.cpp | 3 | ||||
-rw-r--r-- | src/tools/uic/cpp/cppwriteinitialization.cpp | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index e93e6bb26c..a99d6adf07 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -291,9 +291,8 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global) const StringMap::const_iterator hit = m_oldHeaderToNewHeader.constFind(sit.key()); const bool mapped = hit != m_oldHeaderToNewHeader.constEnd(); const QString header = mapped ? hit.value() : sit.key(); - if (!header.trimmed().isEmpty()) { + if (!QStringRef(&header).trimmed().isEmpty()) m_output << "#include " << openingQuote << header << closingQuote << QLatin1Char('\n'); - } } } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 7466da47f3..b996aa8e45 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -2473,10 +2473,8 @@ void WriteInitialization::acceptWidgetScripts(const DomScripts &widgetScripts, D QString script; for (const DomScript *domScript : qAsConst(scripts)) { const QString snippet = domScript->text(); - if (!snippet.isEmpty()) { - script += snippet.trimmed(); - script += QLatin1Char('\n'); - } + if (!snippet.isEmpty()) + script += QStringRef(&snippet).trimmed() + QLatin1Char('\n'); } if (script.isEmpty()) return; |