summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-06-27 16:40:57 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-07-05 18:57:35 +0000
commit5392259ce6df9b9852a8580831cff4139fe2677c (patch)
treed2a30f30e4c5f74341fff9605ddfd46fb549b203
parente7d476031474786a2e11ff6d3f9af0d5244f19d8 (diff)
QXml: reduce allocations in extractEncodingDecl
Replace QString::left() with QString::leftRef(). Use QStringLiteral more. Change-Id: Ibcecc666d034a5e1fe963119483030ab397b16b1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/xml/sax/qxml.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index d4c8519d67..fe21bca810 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -1295,7 +1295,8 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText)
*needMoreText = false;
int l = text.length();
- QString snip = QString::fromLatin1("<?xml").left(l);
+ const QString declStart = QStringLiteral("<?xml");
+ const QStringRef snip = declStart.leftRef(l);
if (l > 0 && !text.startsWith(snip))
return QString();