Move commit
authorbdemsky <bdemsky@uci.edu>
Sat, 7 Apr 2018 10:09:12 +0000 (03:09 -0700)
committerbdemsky <bdemsky@uci.edu>
Sat, 7 Apr 2018 10:17:01 +0000 (03:17 -0700)
version2/src/C/CloudComm.cpp
version2/src/C/Commit.cpp
version2/src/C/Commit.h
version2/src/C/IoTString.h
version2/src/C/KeyValue.cpp
version2/src/C/NewKey.cpp
version2/src/C/Table.cpp
version2/src/C/Test.ino
version2/src/C/hashset.h
version2/src/C/hashtable.h

index 9ecbd97a05cdf7deeebe003f58e7301ef012d5d5..ddd0c7bbc68a5d67a2977e76e51392faa380beec 100755 (executable)
@@ -40,10 +40,10 @@ CloudComm::CloudComm() :
  * Constructor for actual use. Takes in the url and password.
  */
 CloudComm::CloudComm(Table *_table,  IoTString *_baseurl, IoTString *_password, int _listeningPort) :
-       baseurl(new IoTString(_baseurl)),
+       baseurl(_baseurl->acquireRef()),
        key(NULL),
        mac(NULL),
-       password(new IoTString(_password)),
+       password(_password->acquireRef()),
        random(new SecureRandom()),
        salt(NULL),
        table(_table),
@@ -63,11 +63,11 @@ CloudComm::~CloudComm() {
        if (salt)
                delete salt;
        if (password)
-               delete password;
+               password->releaseRef();
        if (random)
                delete random;
        if (baseurl)
-               delete baseurl;
+               baseurl->releaseRef();
        if (mac)
                delete mac;
        if (key)
@@ -107,7 +107,7 @@ void CloudComm::initCrypt() {
                return;
        }
        key = initKey();
-       delete password;
+       password->releaseRef();
        password = NULL;// drop password
        mac = new Mac();
        mac->init(key);
index 3078bc1471c8741bb1b29b5b6df0b00723b6a76b..cb88bed67d58f2bfe263759b80cd62e6f02977c4 100755 (executable)
@@ -6,7 +6,6 @@
 Commit::Commit() :
        parts(new MyVector<CommitPart *>()),
        partCount(0),
-       missingParts(NULL),
        fldisComplete(false),
        hasLastPart(false),
        keyValueUpdateSet(new Hashset<KeyValue *, uintptr_t, 0>()),
@@ -21,7 +20,6 @@ Commit::Commit() :
 Commit::Commit(int64_t _sequenceNumber, int64_t _machineId, int64_t _transactionSequenceNumber) :
        parts(new MyVector<CommitPart *>()),
        partCount(0),
-       missingParts(NULL),
        fldisComplete(true),
        hasLastPart(false),
        keyValueUpdateSet(new Hashset<KeyValue *, uintptr_t, 0>()),
@@ -49,8 +47,6 @@ Commit::~Commit() {
                delete keyValueUpdateSet;
        }
        delete liveKeys;
-       if (missingParts != NULL)
-               delete missingParts;
        if (dataBytes != NULL)
                delete dataBytes;
 }
@@ -72,27 +68,21 @@ void Commit::addPartDecode(CommitPart *newPart) {
                previouslySeenPart->setDead();
                previouslySeenPart->releaseRef();
        } else if (newPart->isLastPart()) {
-               missingParts = new Hashset<int32_t>();
                hasLastPart = true;
-
-               for (int i = 0; i < newPart->getPartNumber(); i++) {
-                       if (parts->get(i) == NULL) {
-                               missingParts->add(i);
-                       }
-               }
        }
 
        if (!fldisComplete && hasLastPart) {
-
                // We have seen this part so remove it from the set of missing parts
-               missingParts->remove(newPart->getPartNumber());
-
-               // Check if all the parts have been seen
-               if (missingParts->size() == 0) {
-
-                       // We have all the parts
-                       fldisComplete = true;
+               uint size = parts->size();
+               fldisComplete = true;
+               for(uint i=0; i < size; i++) {
+                       if (parts->get(i) == NULL) {
+                               fldisComplete = false;
+                               break;
+                       }
+               }
 
+               if (fldisComplete) {
                        // Decode all the parts and create the key value guard and update sets
                        decodeCommitData();
 
index b7b19782232c7c2e92c460a1794c425e9bcb6632..1a8e508373e8c487d51314af342c2c3b10b35b2f 100755 (executable)
@@ -7,7 +7,6 @@ class Commit {
 private:
        MyVector<CommitPart *> *parts;
        uint32_t partCount;
-       Hashset<int32_t> *missingParts;
        bool fldisComplete;
        bool hasLastPart;
        Hashset<KeyValue *, uintptr_t, 0> *keyValueUpdateSet;
index 583a098a07df5aff5f663d4e8299d56c1258497a..99e45bb2f287be3ce0e4e549ca812819b8b54ea1 100755 (executable)
@@ -22,8 +22,10 @@ inline unsigned int hashCharArray(Array<char> *array) {
 class IoTString {
 private:
        Array<char> *array;
-       IoTString() {}
        unsigned int hashvalue;
+       unsigned int refCount;
+  IoTString() : refCount (1) {}
+
        /**
         * Builds an IoTString object around the char array.  This
         * constructor makes a copy, so the caller is free to modify the char array.
@@ -32,7 +34,8 @@ private:
 public:
        IoTString(Array<char> *_array) :
                array(new Array<char>(_array)),
-               hashvalue(hashCharArray(array)) {
+                       hashvalue(hashCharArray(array)),
+                       refCount(1) {
        }
 
        IoTString(const char *_array) {
@@ -40,13 +43,25 @@ public:
                array = new Array<char>(len);
                memcpy(array->internalArray(), _array, len);
                hashvalue = hashCharArray(array);
+               refCount = 1;
        }
 
        IoTString(IoTString *string) :
          array(new Array<char>(string->array)),
-               hashvalue(string->hashvalue) {
+                       hashvalue(string->hashvalue),
+                       refCount(1) {
+       }
+
+       IoTString * acquireRef() {
+               refCount++;
+               return this;
        }
 
+       void releaseRef() {
+               if ((--refCount) == 0)
+                       delete this;
+       }
+       
        ~IoTString() {
                delete array;
        }
index 13ecc34701dba9dddbadc423a085c15ea06706cd..d3518354c748a88afe9bffad664ddfa00d0f2fd6 100755 (executable)
@@ -8,8 +8,8 @@
  */
 
 KeyValue::~KeyValue() {
-       delete key;
-       delete value;
+       key->releaseRef();
+       value->releaseRef();
 }
 
 KeyValue *KeyValue_decode(ByteBuffer *bb) {
@@ -47,5 +47,5 @@ int32_t KeyValue::getSize() {
 }
 
 KeyValue *KeyValue::getCopy() {
-       return new KeyValue(new IoTString(key), new IoTString(value));
+       return new KeyValue(key->acquireRef(), value->acquireRef());
 }
index 0b35933b85750ba375414a8b18a64be8987c4559..edc5e9e43458422a14c96bbfee17a28080b6f627 100755 (executable)
@@ -4,12 +4,12 @@
 
 NewKey::NewKey(Slot *slot, IoTString *_key, int64_t _machineid) :
        Entry(slot),
-       key(new IoTString(_key)),
+       key(_key->acquireRef()),
        machineid(_machineid) {
 }
 
 NewKey::~NewKey() {
-       delete key;
+       key->releaseRef();
 }
 
 Entry *NewKey_decode(Slot *slot, ByteBuffer *bb) {
@@ -19,7 +19,7 @@ Entry *NewKey_decode(Slot *slot, ByteBuffer *bb) {
        int64_t machineid = bb->getLong();
        IoTString *str = IoTString_shallow(key);
        NewKey *newkey = new NewKey(slot, str, machineid);
-       delete str;
+       str->releaseRef();
        return newkey;
 }
 
index 4db92da9999288e08fac8158a844e51ed9cab53b..4fba386614f9c2de56c3bc149459044e5a39d830 100755 (executable)
@@ -47,10 +47,10 @@ Table::Table(IoTString *baseurl, IoTString *password, int64_t _localMachineId, i
        localMachineId(_localMachineId),
        sequenceNumber(0),
        localSequenceNumber(0),
-       localTransactionSequenceNumber(0),
+       localTransactionSequenceNumber(1),
        lastTransactionSequenceNumberSpeculatedOn(0),
        oldestTransactionSequenceNumberSpeculatedOn(0),
-       localArbitrationSequenceNumber(0),
+       localArbitrationSequenceNumber(1),
        hadPartialSendToServer(false),
        attemptedToSendToServer(false),
        expectedsize(0),
@@ -109,10 +109,10 @@ Table::Table(CloudComm *_cloud, int64_t _localMachineId) :
        localMachineId(_localMachineId),
        sequenceNumber(0),
        localSequenceNumber(0),
-       localTransactionSequenceNumber(0),
+       localTransactionSequenceNumber(1),
        lastTransactionSequenceNumberSpeculatedOn(0),
        oldestTransactionSequenceNumberSpeculatedOn(0),
-       localArbitrationSequenceNumber(0),
+       localArbitrationSequenceNumber(1),
        hadPartialSendToServer(false),
        attemptedToSendToServer(false),
        expectedsize(0),
@@ -393,7 +393,7 @@ IoTString *Table::getCommitted(IoTString *key)  {
        KeyValue *kv = committedKeyValueTable->get(key);
 
        if (kv != NULL) {
-               return new IoTString(kv->getValue());
+               return kv->getValue()->acquireRef();
        } else {
                return NULL;
        }
@@ -411,7 +411,7 @@ IoTString *Table::getSpeculative(IoTString *key) {
        }
 
        if (kv != NULL) {
-               return new IoTString(kv->getValue());
+               return kv->getValue()->acquireRef();
        } else {
                return NULL;
        }
@@ -434,7 +434,7 @@ IoTString *Table::getCommittedAtomic(IoTString *key) {
 
        if (kv != NULL) {
                pendingTransactionBuilder->addKVGuard(new KeyValue(key, kv->getValue()));
-               return new IoTString(kv->getValue());
+               return kv->getValue()->acquireRef();
        } else {
                pendingTransactionBuilder->addKVGuard(new KeyValue(key, NULL));
                return NULL;
@@ -466,7 +466,7 @@ IoTString *Table::getSpeculativeAtomic(IoTString *key) {
 
        if (kv != NULL) {
                pendingTransactionBuilder->addKVGuard(new KeyValue(key, kv->getValue()));
-               return new IoTString(kv->getValue());
+               return kv->getValue()->acquireRef();
        } else {
                pendingTransactionBuilder->addKVGuard(new KeyValue(key, NULL));
                return NULL;
@@ -530,7 +530,7 @@ void Table::put(IoTString *key, IoTString *value) {
        }
 
        // Add the key value to this transaction
-       KeyValue *kv = new KeyValue(new IoTString(key), new IoTString(value));
+       KeyValue *kv = new KeyValue(key->acquireRef(), value->acquireRef());
        pendingTransactionBuilder->addKV(kv);
 }
 
index 1d31229e9cb97b942f05c8be315328e3e41606c6..de6a0ffce2b51525e08dba78855d6b6426b185c8 100644 (file)
@@ -24,8 +24,9 @@ void setup() {
        t2 = new Table(baseurl, password, 351, -1);
        t2->update();
 
-       delete baseurl; delete password;
-
+       baseurl->releaseRef();
+       password->releaseRef();
+       
        // Make the Keys
        for (int i = 0; i < NUMBER_OF_TESTS; i++) {
                char buffer[80];
@@ -41,10 +42,10 @@ void setup() {
                t1->createNewKey(ib, 351);
                t2->createNewKey(ic, 321);
                t2->createNewKey(id, 351);
-               delete ia;
-               delete ib;
-               delete ic;
-               delete id;
+               ia->releaseRef();
+               ib->releaseRef();
+               ic->releaseRef();
+               id->releaseRef();
        }
 }
 
@@ -73,22 +74,26 @@ void loop() {
                t1->startTransaction();
                t1->put(iKeyA, iValueA);
                transStatusList->add(t1->commitTransaction());
-               delete iKeyA; delete iValueA;
+               iKeyA->releaseRef();
+               iValueA->releaseRef();
                
                t1->startTransaction();
                t1->put(iKeyB, iValueB);
                transStatusList->add(t1->commitTransaction());
-               delete iKeyB; delete iValueB;
+               iKeyB->releaseRef();
+               iValueB->releaseRef();
                
                t2->startTransaction();
                t2->put(iKeyC, iValueC);
                transStatusList->add(t2->commitTransaction());
-               delete iKeyC; delete iValueC;
+               iKeyC->releaseRef();
+               iValueC->releaseRef();
                
                t2->startTransaction();
                t2->put(iKeyD, iValueD);
                transStatusList->add(t2->commitTransaction());
-               delete iKeyD; delete iValueD;
+               iKeyD->releaseRef();
+               iValueD->releaseRef();
        }
        
        t1->update();
@@ -161,14 +166,22 @@ void loop() {
 //                     printf("Key-Value t2 incorrect: keyD     testValD2\n");
                        foundError = true;
                }
-               delete iKeyA; delete iValueA;
-               delete iKeyB; delete iValueB;
-               delete iKeyC; delete iValueC;
-               delete iKeyD; delete iValueD;
-               delete testValA1; delete testValA2;
-               delete testValB1; delete testValB2;
-               delete testValC1; delete testValC2;
-               delete testValD1; delete testValD2;
+               iKeyA->releaseRef();
+               iValueA->releaseRef();
+               iKeyB->releaseRef();
+               iValueB->releaseRef();
+               iKeyC->releaseRef();
+               iValueC->releaseRef();
+               iKeyD->releaseRef();
+               iValueD->releaseRef();
+               testValA1->releaseRef();
+               testValA2->releaseRef();
+               testValB1->releaseRef();
+               testValB2->releaseRef();
+               testValC1->releaseRef();
+               testValC2->releaseRef();
+               testValD1->releaseRef();
+               testValD2->releaseRef();
        }
 
        for (uint i = 0; i < transStatusList->size(); i++) {
@@ -185,6 +198,7 @@ void loop() {
        } else {
        }
 
-       transStatusList->clear();
+       delete transStatusList;
+       delete t1;
 }
 
index 5c81425b5b26ca9ad69a5587c806cf8b01e5c128..73495060ac6a3eb0c1f7af7d04330f46c7684797 100755 (executable)
@@ -17,8 +17,9 @@ class Hashset;
 template<typename _Key, typename _Val, typename _KeyInt = uintptr_t, int _Shift = 0, unsigned int (*hash_function)(_Key) = defaultHashFunction<_Key, _Shift, _KeyInt>, bool (*equals)(_Key, _Key) = defaultEquals<_Key> >
 class SetIterator {
 public:
-       SetIterator(Hashlistnode<_Key, _Val> *_curr, Hashtable <_Key, _Val, _KeyInt, _Shift, hash_function, equals> *_table) :
-               curr(_curr),
+       SetIterator(Hashtable <_Key, _Val, _KeyInt, _Shift, hash_function, equals> *_table) :
+    currptr(1),
+    nextptr(0),
                table(_table)
        {
        }
@@ -44,32 +45,52 @@ public:
        }
 
        bool hasNext() {
-               return curr != NULL;
+               if (currptr > nextptr) {
+                       currptr = 0;
+               } else {
+                       nextptr++;
+               }
+               if (nextptr == 0) {
+                       if (table->zero && table->zero->val)
+                               return true;
+                       else
+                               nextptr++;
+               }
+               for(;nextptr < (table->capacity + 1);nextptr++) {
+                       struct Hashlistnode<_Key, _Val> *ptr = & table->table[nextptr-1];
+                       if (ptr->key && ptr->val) {
+                               return true;
+                       }
+               }
+               return false;
        }
 
   _Val currVal() {
-         return last->val;
+    if (currptr == 0)
+                       return table->zero->val;
+               else
+                       return table->table[currptr-1].val;
   }
 
-  _Key next() {
-               _Key k = curr->key;
-               last = curr;
-               curr = curr->next;
-               return k;
+  _Key currKey() {
+               if (currptr == 0)
+                       return table->zero->key;
+               else
+                       return table->table[currptr-1].key;
        }
 
-       _Key currKey() {
-               return last->key;
+  _Key next() {
+               currptr = nextptr;
+               return currKey();
        }
 
        void remove() {
-               _Key k = last->key;
-               table->remove(k);
+               table->remove(currKey());
        }
 
 private:
-       Hashlistnode<_Key,_Val> *curr;
-       Hashlistnode<_Key, _Val> *last;
+  unsigned int currptr;
+  unsigned int nextptr;
        Hashtable <_Key, _Val, _KeyInt, _Shift, hash_function, equals> *table;
 };
 
@@ -151,7 +172,7 @@ public:
        }
 
        SetIterator<_Key, _Key, _KeyInt, _Shift, hash_function, equals> *iterator() {
-               return new SetIterator<_Key, _Key, _KeyInt, _Shift, hash_function, equals>(table->list, table);
+               return new SetIterator<_Key, _Key, _KeyInt, _Shift, hash_function, equals>(table);
        }
 
        /** Override: new operator */
@@ -179,6 +200,6 @@ private:
 
 template<typename _Key, typename _Val, typename _KeyInt, int _Shift, unsigned int (*hash_function)(_Key), bool (*equals)(_Key, _Key)>
 SetIterator<_Key, _Val,_KeyInt, _Shift, hash_function, equals> *getKeyIterator(Hashtable<_Key,_Val,_KeyInt,_Shift,hash_function,equals> *table) {
-       return new SetIterator<_Key, _Val, _KeyInt, _Shift, hash_function, equals>(table->list, table);
+       return new SetIterator<_Key, _Val, _KeyInt, _Shift, hash_function, equals>(table);
 }
 #endif
index 439e48bb5b461e07d065210a449c54e87b89f01e..96e73ce5588504f9552ef359303149f536dfe226 100755 (executable)
@@ -30,9 +30,6 @@ template<typename _Key, typename _Val>
 struct Hashlistnode {
        _Key key;
        _Val val;
-       uint hashcode;
-       struct Hashlistnode<_Key, _Val> *next;
-       struct Hashlistnode<_Key, _Val> *prev;
 };
 
 template<typename _Key, int _Shift, typename _KeyInt>
@@ -70,7 +67,7 @@ public:
         * @param factor Sets the percentage full before the hashtable is
         * resized. Default ratio 0.5.
         */
-       Hashtable(unsigned int initialcapacity = 1024, double factor = 0.5) {
+       Hashtable(unsigned int initialcapacity = 16, double factor = 0.5) {
                // Allocate space for the hash table
                table = (struct Hashlistnode<_Key, _Val> *)ourcalloc(initialcapacity, sizeof(struct Hashlistnode<_Key, _Val>));
                zero = NULL;
@@ -80,15 +77,17 @@ public:
 
                threshold = (unsigned int)(initialcapacity * loadfactor);
                Size = 0;                                                       // Initial number of elements in the hash
-               tail = list = NULL;
        }
 
        Hashtable<_Key, _Val, _KeyInt, _Shift, hash_function, equals> *clone() {
                Hashtable<_Key, _Val, _KeyInt, _Shift, hash_function, equals> *ctable = new Hashtable<_Key, _Val, _KeyInt, _Shift, hash_function, equals> (capacity, loadfactor);
-               struct Hashlistnode<_Key, _Val> *ptr = list;
-               while (ptr != NULL) {
-                       ctable->put(ptr->key, ptr->val);
-                       ptr = ptr->next;
+               if (zero)
+                       ctable->put(zero->key, zero->val);
+
+               for(unsigned int i=0; i<capacity; i++) {
+                       struct Hashlistnode<_Key, _Val> ptr = table[i];                 
+                       if (ptr.key && ptr.val)
+                               ctable->put(ptr.key, ptr.val);
                }
                return ctable;
        }
@@ -129,7 +128,6 @@ public:
                        zero = NULL;
                }
                Size = 0;
-               tail = list = NULL;
        }
 
        void resetAndDeleteKeys() {
@@ -148,7 +146,6 @@ public:
                        zero = NULL;
                }
                Size = 0;
-               tail = list = NULL;
        }
 
        void resetAndDeleteVals() {
@@ -169,7 +166,6 @@ public:
                        zero = NULL;
                }
                Size = 0;
-               tail = list = NULL;
        }
 
        void resetAndFreeVals() {
@@ -190,7 +186,6 @@ public:
                        zero = NULL;
                }
                Size = 0;
-               tail = list = NULL;
        }
 
        /**
@@ -199,17 +194,11 @@ public:
         * @param val The value to store in the table
         */
        _Val put(_Key key, _Val val) {
-               /* Hashtable cannot handle 0 as a key */
+               ASSERT(val);
                if (!key) {
                        _Val oldval;
                        if (!zero) {
                                zero = (struct Hashlistnode<_Key, _Val> *)ourmalloc(sizeof(struct Hashlistnode<_Key, _Val>));
-                               zero->next = list;
-                               if (list != NULL)
-                                       list->prev = zero;
-                               else
-                                       tail = zero;
-                               list = zero;
                                Size++;
                                oldval = (_Val) 0;
                        } else
@@ -233,7 +222,8 @@ public:
                                //key is null, probably done
                                break;
                        }
-                       if (search->hashcode == hashcode)
+                       unsigned int searchhashcode = hash_function(search->key);
+                       if (searchhashcode == hashcode)
                                if (equals(search->key, key)) {
                                        _Val oldval = search->val;
                                        search->val = val;
@@ -244,13 +234,6 @@ public:
 
                search->key = key;
                search->val = val;
-               search->hashcode = hashcode;
-               search->next = list;
-               if (list == NULL)
-                       tail = search;
-               else
-                       list->prev = search;
-               list = search;
                Size++;
                return (_Val) 0;
        }
@@ -279,10 +262,12 @@ public:
                        if (!search->key) {
                                if (!search->val)
                                        break;
-                       } else
-                       if (hashcode == search->hashcode)
-                               if (equals(search->key, key))
-                                       return search->val;
+                       } else {
+                               unsigned int searchhashcode = hash_function(search->key);
+                               if (hashcode == searchhashcode)
+                                       if (equals(search->key, key))
+                                               return search->val;
+                       }
                        index++;
                        index &= capacitymask;
                        if (index == oindex)
@@ -304,15 +289,6 @@ public:
                                return (_Val)0;
                        } else {
                                _Val v = zero->val;
-                               if (zero->next != NULL)
-                                       zero->next->prev = zero->prev;
-                               else
-                                       tail = zero->prev;
-
-                               if (zero->prev != NULL)
-                                       zero->prev->next = zero->next;
-                               else
-                                       list = zero->next;
 
                                ourfree(zero);
                                zero = NULL;
@@ -330,27 +306,18 @@ public:
                        if (!search->key) {
                                if (!search->val)
                                        break;
-                       } else
-                       if (hashcode == search->hashcode)
-                               if (equals(search->key, key)) {
-                                       _Val v = search->val;
-                                       //empty out this bin
-                                       search->val = (_Val) 1;
-                                       search->key = 0;
-
-                                       if (search->next != NULL)
-                                               search->next->prev = search->prev;
-                                       else
-                                               tail = search->prev;
-
-                                       if (search->prev != NULL)
-                                               search->prev->next = search->next;
-                                       else
-                                               list = search->next;
-
-                                       Size--;
-                                       return v;
-                               }
+                       } else {
+                               unsigned int searchhashcode = hash_function(search->key);
+                               if (hashcode == searchhashcode)
+                                       if (equals(search->key, key)) {
+                                               _Val v = search->val;
+                                               //empty out this bin
+                                               search->val = (_Val) 1;
+                                               search->key = 0;
+                                               Size--;
+                                               return v;
+                                       }
+                       }
                        index++;
                } while (true);
                return (_Val)0;
@@ -382,10 +349,12 @@ public:
                        if (!search->key) {
                                if (!search->val)
                                        break;
-                       } else
-                       if (hashcode == search->hashcode)
-                               if (equals(search->key, key))
-                                       return true;
+                       } else {
+                               unsigned int searchhashcode = hash_function(search->key);
+                               if (hashcode == searchhashcode)
+                                       if (equals(search->key, key))
+                                               return true;
+                       }
                        index++;
                } while (true);
                return false;
@@ -407,7 +376,6 @@ public:
                table = newtable;                                                                                       // Update the global hashtable upon resize()
                capacity = newsize;
                capacitymask = newsize - 1;
-               list = tail = NULL;
                threshold = (unsigned int)(newsize * loadfactor);
 
                struct Hashlistnode<_Key, _Val> *bin = &oldtable[0];
@@ -419,7 +387,7 @@ public:
                        if (!key)
                                continue;
 
-                       unsigned int hashcode = bin->hashcode;
+                       unsigned int hashcode = hash_function(bin->key);
                        unsigned int index = hashcode;
                        do {
                                index &= capacitymask;
@@ -427,13 +395,6 @@ public:
                                index++;
                        } while (search->key);
 
-                       if (tail == NULL)
-                               tail = search;
-                       search->next = list;
-                       if (list != NULL)
-                               list->prev = search;
-                       list = search;
-                       search->hashcode = hashcode;
                        search->key = key;
                        search->val = bin->val;
                }
@@ -444,8 +405,6 @@ public:
        unsigned int getCapacity() {return capacity;}
        struct Hashlistnode<_Key, _Val> *table;
        struct Hashlistnode<_Key, _Val> *zero;
-       struct Hashlistnode<_Key, _Val> *list;
-       struct Hashlistnode<_Key, _Val> *tail;
        unsigned int capacity;
        unsigned int Size;
 private: