Micro-optimize QUrl::topLevelDomain

Using QStringRef saves few instructions

Change-Id: I0d67a1f6a1c1385c88a8b21cb98b9c7dbdfb66e5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This commit is contained in:
Jędrzej Nowacki 2014-05-14 14:35:21 +02:00 committed by Thiago Macieira
parent 5dd7164c97
commit 8f22f242a2

View File

@ -43,7 +43,8 @@
#include "qurl.h"
#include "private/qurltlds_p.h"
#include "private/qtldurl_p.h"
#include "QtCore/qstringlist.h"
#include "QtCore/qstring.h"
#include "QtCore/qvector.h"
#include "QtCore/qhash.h"
QT_BEGIN_NAMESPACE
@ -80,7 +81,8 @@ static bool containsTLDEntry(const QString &entry)
Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain)
{
QStringList sections = domain.toLower().split(QLatin1Char('.'), QString::SkipEmptyParts);
const QString domainLower = domain.toLower();
QVector<QStringRef> sections = domainLower.splitRef(QLatin1Char('.'), QString::SkipEmptyParts);
if (sections.isEmpty())
return QString();