diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-04-05 20:23:43 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:48:54 +0200 |
commit | 6452f7a57452dc35c414d7e3c13c79115dd145ed (patch) | |
tree | e0513c6de7b56e323308f1b288447eb0e78155e7 /src/qml/jsruntime/qv4identifiertable.cpp | |
parent | b11ec085703a0b019c8115ff505ee6e2553fd4f1 (diff) |
Move string data into subclass
Change-Id: I95dcdda8c68e2a5c36244798c8c10dcfdd69d2c2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4identifiertable.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4identifiertable.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp index 3b56b5cf9f..2d127af0e6 100644 --- a/src/qml/jsruntime/qv4identifiertable.cpp +++ b/src/qml/jsruntime/qv4identifiertable.cpp @@ -69,7 +69,7 @@ IdentifierTable::~IdentifierTable() { for (int i = 0; i < alloc; ++i) if (entries[i]) - delete entries[i]->identifier; + delete entries[i]->stringData()->identifier; free(entries); } @@ -80,9 +80,9 @@ void IdentifierTable::addEntry(String *str) if (str->subtype() == String::StringType_ArrayIndex) return; - str->identifier = new Identifier; - str->identifier->string = str->toQString(); - str->identifier->hashValue = hash; + str->stringData()->identifier = new Identifier; + str->stringData()->identifier->string = str->toQString(); + str->stringData()->identifier->hashValue = hash; bool grow = (alloc <= size*2); @@ -95,7 +95,7 @@ void IdentifierTable::addEntry(String *str) String *e = entries[i]; if (!e) continue; - uint idx = e->stringHash % newAlloc; + uint idx = e->stringData()->stringHash % newAlloc; while (newEntries[idx]) { ++idx; idx %= newAlloc; @@ -123,7 +123,7 @@ String *IdentifierTable::insertString(const QString &s) uint hash = String::createHashValue(s.constData(), s.length()); uint idx = hash % alloc; while (String *e = entries[idx]) { - if (e->stringHash == hash && e->toQString() == s) + if (e->stringData()->stringHash == hash && e->toQString() == s) return e; ++idx; idx %= alloc; @@ -137,29 +137,29 @@ String *IdentifierTable::insertString(const QString &s) Identifier *IdentifierTable::identifierImpl(const String *str) { - if (str->identifier) - return str->identifier; + if (str->stringData()->identifier) + return str->stringData()->identifier; uint hash = str->hashValue(); if (str->subtype() == String::StringType_ArrayIndex) return 0; uint idx = hash % alloc; while (String *e = entries[idx]) { - if (e->stringHash == hash && e->isEqualTo(str)) { - str->identifier = e->identifier; - return e->identifier; + if (e->stringData()->stringHash == hash && e->isEqualTo(str)) { + str->stringData()->identifier = e->stringData()->identifier; + return e->stringData()->identifier; } ++idx; idx %= alloc; } addEntry(const_cast<QV4::String *>(str)); - return str->identifier; + return str->stringData()->identifier; } Identifier *IdentifierTable::identifier(const QString &s) { - return insertString(s)->identifier; + return insertString(s)->stringData()->identifier; } Identifier *IdentifierTable::identifier(const char *s, int len) @@ -171,15 +171,15 @@ Identifier *IdentifierTable::identifier(const char *s, int len) QLatin1String latin(s, len); uint idx = hash % alloc; while (String *e = entries[idx]) { - if (e->stringHash == hash && e->toQString() == latin) - return e->identifier; + if (e->stringData()->stringHash == hash && e->toQString() == latin) + return e->stringData()->identifier; ++idx; idx %= alloc; } String *str = engine->newString(QString::fromLatin1(s, len))->getPointer(); addEntry(str); - return str->identifier; + return str->stringData()->identifier; } } |