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>
This commit is contained in:
parent
e7d4760314
commit
5392259ce6
@ -1295,7 +1295,8 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText)
|
|||||||
*needMoreText = false;
|
*needMoreText = false;
|
||||||
|
|
||||||
int l = text.length();
|
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))
|
if (l > 0 && !text.startsWith(snip))
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user