diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-03-30 18:35:23 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-03-31 15:51:08 +0000 |
commit | f8192405ef9f819f0732d65a2b047c8dd5cfabb6 (patch) | |
tree | 55650993bdf5880dd3c24c2eb074f4a776fac3e4 /src | |
parent | 32006535461d05d48bb8c63d27ed7e08215d7165 (diff) |
QTimeZonePrivate: avoid unnecessary allocations
... by replacing QString::split() with QString::splitRef()
and using the new overloaded functions:
- QLocalePrivate::languageToCode(QStringRef)
- QLocalePrivate::languageToCode(const QChar*, int)
Change-Id: I2884bdc6d3e27963ce121d659a5e092b10b4ef8c
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_tz.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_win.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index 3fcc8833e8..8040365581 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -84,7 +84,7 @@ static QTzTimeZoneHash loadTzTimeZones() // Comment lines are prefixed with a # if (!line.isEmpty() && line.at(0) != '#') { // Data rows are tab-separated columns Region, Coordinates, ID, Optional Comments - const QStringList parts = line.split('\t'); + const auto parts = line.splitRef(QLatin1Char('\t')); QTzTimeZone zone; zone.country = QLocalePrivate::codeToCountry(parts.at(0)); if (parts.size() > 3) diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp index f84b66fa99..8e32db48de 100644 --- a/src/corelib/tools/qtimezoneprivate_win.cpp +++ b/src/corelib/tools/qtimezoneprivate_win.cpp @@ -391,7 +391,7 @@ static QLocale::Country userCountry() const GEOID id = GetUserGeoID(GEOCLASS_NATION); wchar_t code[3]; const int size = GetGeoInfo(id, GEO_ISO2, code, 3, 0); - return (size == 3) ? QLocalePrivate::codeToCountry(QString::fromWCharArray(code)) + return (size == 3) ? QLocalePrivate::codeToCountry(reinterpret_cast<const QChar*>(code), size) : QLocale::AnyCountry; #endif // Q_OS_WINCE } |