* themselves from our hash table a second time, the entry is already gone. */
while (internal_hashmap_size(h) > 0) {
- void *v, *k;
+ void *k = NULL;
+ void *v;
v = internal_hashmap_first_key_and_value(h, true, &k);
unsigned idx;
idx = find_first_entry(h);
- if (idx == IDX_NIL)
+ if (idx == IDX_NIL) {
+ if (ret_key)
+ *ret_key = NULL;
return NULL;
+ }
e = bucket_at(h, idx);
key = (void*) e->key;
}
unsigned internal_hashmap_size(HashmapBase *h) {
-
if (!h)
return 0;
}
unsigned internal_hashmap_buckets(HashmapBase *h) {
-
if (!h)
return 0;
if (cache) {
free(cache->keys.ptr);
free(cache->values.ptr);
- free(cache);
}
- return NULL;
+ return mfree(cache);
}