| | |
| | | size_t code = hashcode(key); |
| | | tailq_entry_t *item; |
| | | void *oldvalue; |
| | | |
| | | SemUtil::dec(hashtable->wlock); |
| | | tailq_header_t *my_tailq_head = hashtable->array[code] ; |
| | | if ( my_tailq_head == NULL) |
| | | { |
| | | SemUtil::inc(hashtable->wlock); |
| | | return NULL; |
| | | } |
| | | else |
| | |
| | | |
| | | /* mm_free the item as we don't need it anymore. */ |
| | | mm_free(item); |
| | | |
| | | SemUtil::inc(hashtable->wlock); |
| | | return oldvalue; |
| | | } |
| | | } |
| | | } |
| | | SemUtil::inc(hashtable->wlock); |
| | | return NULL; |
| | | |
| | | } |
| | |
| | | void hashtable_removeall(hashtable_t *hashtable) |
| | | { |
| | | tailq_entry_t *item; |
| | | SemUtil::dec(hashtable->wlock); |
| | | for (int i = 0; i < MAPSIZE; i++) |
| | | { |
| | | tailq_header_t *my_tailq_head = hashtable->array[i] ; |
| | |
| | | mm_free(my_tailq_head); |
| | | hashtable->array[i] = NULL; |
| | | } |
| | | SemUtil::inc(hashtable->wlock); |
| | | } |
| | | |
| | | /** |