56,13 → 56,15 |
index_t i; |
|
ASSERT(h); |
ASSERT(op && op->hash && op->compare); |
ASSERT(op); |
ASSERT(op->hash); |
ASSERT(op->compare); |
ASSERT(max_keys > 0); |
|
h->entry = (link_t *) malloc(m * sizeof(link_t), 0); |
if (!h->entry) { |
if (!h->entry) |
panic("Cannot allocate memory for hash table."); |
} |
|
memsetb(h->entry, m * sizeof(link_t), 0); |
|
for (i = 0; i < m; i++) |
84,7 → 86,10 |
index_t chain; |
|
ASSERT(item); |
ASSERT(h && h->op && h->op->hash && h->op->compare); |
ASSERT(h); |
ASSERT(h->op); |
ASSERT(h->op->hash); |
ASSERT(h->op->compare); |
|
chain = h->op->hash(key); |
ASSERT(chain < h->entries); |
104,7 → 109,10 |
link_t *cur; |
index_t chain; |
|
ASSERT(h && h->op && h->op->hash && h->op->compare); |
ASSERT(h); |
ASSERT(h->op); |
ASSERT(h->op->hash); |
ASSERT(h->op->compare); |
|
chain = h->op->hash(key); |
ASSERT(chain < h->entries); |
134,7 → 142,11 |
index_t chain; |
link_t *cur; |
|
ASSERT(h && h->op && h->op->hash && h->op->compare && h->op->remove_callback); |
ASSERT(h); |
ASSERT(h->op); |
ASSERT(h->op->hash); |
ASSERT(h->op->compare); |
ASSERT(h->op->remove_callback); |
ASSERT(keys <= h->max_keys); |
|
if (keys == h->max_keys) { |