From: Mauritz Sundell Date: October 13 2011 9:39am Subject: bzr push into mysql-5.1-telco-7.0 branch (mauritz.sundell:4594 to 4595) List-Archive: http://lists.mysql.com/commits/141419 Message-Id: <201110130939.p9D9dsQq000753@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4595 Mauritz Sundell 2011-10-13 ndb - move helper methods from entry class to super class for DLHashTable To enable multiple hash tables on same object the helper methods equal() and hashValue() need to be different not only the linked list members (nextHash, prevHash). Moving the methods from entry class, T, to superclass, U. All used instances of DLHashTable used U=T so no change in function is expected. modified: storage/ndb/src/kernel/vm/DLHashTable.hpp 4594 Jonas Oreland 2011-10-13 ndb - improve column comments on new ndb$info tables modified: storage/ndb/src/kernel/vm/NdbinfoTables.cpp === modified file 'storage/ndb/src/kernel/vm/DLHashTable.hpp' --- a/storage/ndb/src/kernel/vm/DLHashTable.hpp 2011-10-07 11:46:40 +0000 +++ b/storage/ndb/src/kernel/vm/DLHashTable.hpp 2011-10-13 09:25:13 +0000 @@ -27,11 +27,16 @@ * (with a double linked list) * * The entries in the hashtable must have the following methods: - * -# bool equal(const class T &) const; + * -# bool U::equal(const class U &) const; * Which should return equal if the to objects have the same key - * -# Uint32 hashValue() const; + * -# Uint32 U::hashValue() const; * Which should return a 32 bit hashvalue + * + * and the following members: + * -# Uint32 U::nextHash; + * -# Uint32 U::prevHash; */ + template class DLHashTableImpl { @@ -211,7 +216,7 @@ inline void DLHashTableImpl::add(Ptr & obj) { - const Uint32 hv = obj.p->hashValue() & mask; + const Uint32 hv = obj.p->U::hashValue() & mask; const Uint32 i = hashValues[hv]; if(i == RNIL) @@ -288,7 +293,7 @@ inline void DLHashTableImpl::remove(Ptr & ptr, const T & key) { - const Uint32 hv = key.hashValue() & mask; + const Uint32 hv = key.U::hashValue() & mask; Uint32 i; T * p; @@ -300,7 +305,7 @@ DLHashTableImpl::remove(Ptr while(i != RNIL) { p = thePool.getPtr(i); - if(key.equal(* p)) + if(key.U::equal(* p)) { const Uint32 next = p->U::nextHash; if(prev.i == RNIL) @@ -366,7 +371,7 @@ DLHashTableImpl::remove(Ptr } else { - const Uint32 hv = ptr.p->hashValue() & mask; + const Uint32 hv = ptr.p->U::hashValue() & mask; if (hashValues[hv] == ptr.i) { hashValues[hv] = next; @@ -400,7 +405,7 @@ DLHashTableImpl::release(Ptr } else { - const Uint32 hv = ptr.p->hashValue() & mask; + const Uint32 hv = ptr.p->U::hashValue() & mask; if (hashValues[hv] == ptr.i) { hashValues[hv] = next; @@ -493,7 +498,7 @@ inline bool DLHashTableImpl::find(Ptr & ptr, const T & key) const { - const Uint32 hv = key.hashValue() & mask; + const Uint32 hv = key.U::hashValue() & mask; Uint32 i; T * p; @@ -502,7 +507,7 @@ DLHashTableImpl::find(Ptr & while(i != RNIL) { p = thePool.getPtr(i); - if(key.equal(* p)) + if(key.U::equal(* p)) { ptr.i = i; ptr.p = p; No bundle (reason: useless for push emails).