Remove the symbol optimisation from hashed string
authorLars Knoll <lars.knoll@digia.com>
Tue, 25 Jun 2013 20:02:11 +0000 (22:02 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 28 Jun 2013 12:55:58 +0000 (14:55 +0200)
Simplify the code, so we can move over to identifiers later.

Change-Id: I42cb164840ecfd3f765049ab9fa46746a0d4a85b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/qml/ftw/qhashedstring_p.h

index 1261db2..efcee0f 100644 (file)
@@ -110,7 +110,6 @@ public:
 
     inline quint32 hash() const;
     inline int length() const; 
-    inline quint32 symbolId() const;
 
     inline QV4::Value string() const;
 
@@ -268,12 +267,6 @@ public:
         }
     }
 
-    inline bool symbolEquals(const QHashedV4String &string) const {
-        Q_ASSERT(string.symbolId() != 0);
-        return length == string.length() && hash == string.hash() && 
-               (string.symbolId() == symbolId || equals(string.string()));
-    }
-
     inline bool equals(const QHashedV4String &string) const {
         return length == string.length() && hash == string.hash() && 
                equals(string.string());
@@ -402,8 +395,6 @@ public:
     template<typename K>
     inline Node *findNode(const K &) const;
 
-    inline Node *findSymbolNode(const QHashedV4String &) const;
-
     inline Node *createNode(const Node &o);
 
     template<typename K>
@@ -867,21 +858,6 @@ typename QStringHash<T>::Node *QStringHash<T>::findNode(const K &key) const
 }
 
 template<class T>
-typename QStringHash<T>::Node *QStringHash<T>::findSymbolNode(const QHashedV4String &string) const
-{
-    Q_ASSERT(string.symbolId() != 0);
-
-    QStringHashNode *node = data.numBuckets?data.buckets[hashOf(string) % data.numBuckets]:0;
-    while (node && !node->symbolEquals(string))
-        node = (*node->next);
-
-    if (node)
-        node->symbolId = string.symbolId();
-
-    return (Node *)node;
-}
-
-template<class T>
 template<class K>
 T *QStringHash<T>::value(const K &key) const
 {
@@ -899,7 +875,7 @@ T *QStringHash<T>::value(const ConstIterator &iter) const
 template<class T>
 T *QStringHash<T>::value(const QHashedV4String &string) const
 {
-    Node *n = string.symbolId()?findSymbolNode(string):findNode(string);
+    Node *n = findNode(string);
     return n?&n->value:0;
 }
 
@@ -1159,11 +1135,6 @@ int QHashedV4String::length() const
     return m_string.asString()->toQString().length();
 }
 
-quint32 QHashedV4String::symbolId() const
-{
-    return m_string.asString()->identifier;
-}
-
 QV4::Value QHashedV4String::string() const
 {
     return m_string;