diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-03-29 18:41:01 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-03-30 04:38:10 +0000 |
commit | 35b897218c3d3ff902c5e38604f5ecc15c4717d1 (patch) | |
tree | 439c0a30bf492105dc85ed2a21b523b5dcc2a175 /src | |
parent | a1421e47871448718fd54e83f0106a38722bdfe4 (diff) |
Replace internal qt_hash(QString(Ref)) functions with one taking QStringView
Change-Id: I49d07689e642d26b4bceda5cace738aadd828ce0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qhash.cpp | 16 | ||||
-rw-r--r-- | src/corelib/tools/qhashfunctions.h | 3 |
2 files changed, 4 insertions, 15 deletions
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 334bd52f1e..2d97414577 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -406,7 +406,7 @@ void qSetGlobalQHashSeed(int newSeed) The qt_hash functions must *never* change their results. */ -static uint qt_hash(const QChar *p, int n) Q_DECL_NOTHROW +static uint qt_hash(const QChar *p, size_t n) Q_DECL_NOTHROW { uint h = 0; @@ -420,20 +420,10 @@ static uint qt_hash(const QChar *p, int n) Q_DECL_NOTHROW /*! \internal - \overload -*/ -uint qt_hash(const QString &key) Q_DECL_NOTHROW -{ - return qt_hash(key.unicode(), key.size()); -} - -/*! - \internal - \overload */ -uint qt_hash(const QStringRef &key) Q_DECL_NOTHROW +uint qt_hash(QStringView key) Q_DECL_NOTHROW { - return qt_hash(key.unicode(), key.size()); + return qt_hash(key.data(), key.size()); } /* diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h index 0eb6c1b5ce..6c27120823 100644 --- a/src/corelib/tools/qhashfunctions.h +++ b/src/corelib/tools/qhashfunctions.h @@ -99,8 +99,7 @@ Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QString &key, uint seed = 0) Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QStringRef &key, uint seed = 0) Q_DECL_NOTHROW; Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QBitArray &key, uint seed = 0) Q_DECL_NOTHROW; Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QLatin1String key, uint seed = 0) Q_DECL_NOTHROW; -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(const QString &key) Q_DECL_NOTHROW; -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(const QStringRef &key) Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(QStringView key) Q_DECL_NOTHROW; template <class T> inline uint qHash(const T *key, uint seed = 0) Q_DECL_NOTHROW { |