From ea17c21fd8b93a94027fad7d3827904ae96e2a3b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 4 Apr 2012 20:37:04 +0100 Subject: QHostAddress: improve qHash implementation Avoid the conversion to a temporary QString -- just hash the address as a byte array. Change-Id: Ic35cdbbc3ee66c32a28d911bd27de0092395979f Done-with: Shane Kearns Reviewed-by: Thiago Macieira Reviewed-by: Shane Kearns --- src/network/kernel/qhostaddress.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/network/kernel/qhostaddress.h') diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h index b298e3f479..ce4470d32e 100644 --- a/src/network/kernel/qhostaddress.h +++ b/src/network/kernel/qhostaddress.h @@ -123,6 +123,7 @@ public: static QPair parseSubnet(const QString &subnet); + friend Q_NETWORK_EXPORT uint qHash(const QHostAddress &key, uint seed = 0); protected: QScopedPointer d; }; @@ -134,9 +135,6 @@ inline bool operator ==(QHostAddress::SpecialAddress address1, const QHostAddres Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QHostAddress &); #endif - -Q_NETWORK_EXPORT uint qHash(const QHostAddress &key, uint seed = 0); - #ifndef QT_NO_DATASTREAM Q_NETWORK_EXPORT QDataStream &operator<<(QDataStream &, const QHostAddress &); Q_NETWORK_EXPORT QDataStream &operator>>(QDataStream &, QHostAddress &); -- cgit v1.2.3