In both put() and ensureptr(), the 'size' counter should not be incremented
until we decide if we're adding a new bin or not. When incremented improperly,
'size' ended up out of sync with the hash table; it reported a size much larger
than the actual table.
resize(capacity << 1);
struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *ptr = table[(((_KeyInt)key) & mask)>>_Shift];
resize(capacity << 1);
struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *ptr = table[(((_KeyInt)key) & mask)>>_Shift];
struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *search = ptr;
while(search!=NULL) {
struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *search = ptr;
while(search!=NULL) {
newptr->val=val;
newptr->next=ptr;
table[(((_KeyInt)key)&mask)>>_Shift]=newptr;
newptr->val=val;
newptr->next=ptr;
table[(((_KeyInt)key)&mask)>>_Shift]=newptr;
}
/** Put a key entry into the table. */
}
/** Put a key entry into the table. */
resize(capacity << 1);
struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *ptr = table[(((_KeyInt)key) & mask)>>_Shift];
resize(capacity << 1);
struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *ptr = table[(((_KeyInt)key) & mask)>>_Shift];
struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *search = ptr;
while(search!=NULL) {
struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *search = ptr;
while(search!=NULL) {
newptr->key=key;
newptr->next=ptr;
table[(((_KeyInt)key)&mask)>>_Shift]=newptr;
newptr->key=key;
newptr->next=ptr;
table[(((_KeyInt)key)&mask)>>_Shift]=newptr;