hashmap.c | hashmap.c | |||
---|---|---|---|---|
skipping to change at line 268 | skipping to change at line 268 | |||
unlink_entry(h, e, hash); | unlink_entry(h, e, hash); | |||
if (h->from_pool) | if (h->from_pool) | |||
deallocate_tile(&first_entry_tile, e); | deallocate_tile(&first_entry_tile, e); | |||
else | else | |||
free(e); | free(e); | |||
} | } | |||
void hashmap_free(Hashmap*h) { | void hashmap_free(Hashmap*h) { | |||
/* Free the hashmap, but nothing in it */ | ||||
if (!h) | if (!h) | |||
return; | return; | |||
hashmap_clear(h); | hashmap_clear(h); | |||
if (h->from_pool) | if (h->from_pool) | |||
deallocate_tile(&first_hashmap_tile, h); | deallocate_tile(&first_hashmap_tile, h); | |||
else | else | |||
free(h); | free(h); | |||
} | } | |||
void hashmap_free_free(Hashmap *h) { | void hashmap_free_free(Hashmap *h) { | |||
/* Free the hashmap and all data objects in it, but not the | ||||
* keys */ | ||||
if (!h) | if (!h) | |||
return; | return; | |||
hashmap_clear_free(h); | hashmap_clear_free(h); | |||
hashmap_free(h); | hashmap_free(h); | |||
} | } | |||
void hashmap_clear(Hashmap *h) { | void hashmap_clear(Hashmap *h) { | |||
if (!h) | if (!h) | |||
return; | return; | |||
skipping to change at line 374 | skipping to change at line 380 | |||
} | } | |||
void* hashmap_get(Hashmap *h, const void *key) { | void* hashmap_get(Hashmap *h, const void *key) { | |||
unsigned hash; | unsigned hash; | |||
struct hashmap_entry *e; | struct hashmap_entry *e; | |||
if (!h) | if (!h) | |||
return NULL; | return NULL; | |||
hash = h->hash_func(key) % NBUCKETS; | hash = h->hash_func(key) % NBUCKETS; | |||
e = hash_scan(h, hash, key); | ||||
if (!(e = hash_scan(h, hash, key))) | if (!e) | |||
return NULL; | return NULL; | |||
return e->value; | return e->value; | |||
} | } | |||
bool hashmap_contains(Hashmap *h, const void *key) { | bool hashmap_contains(Hashmap *h, const void *key) { | |||
unsigned hash; | unsigned hash; | |||
struct hashmap_entry *e; | ||||
if (!h) | if (!h) | |||
return false; | return false; | |||
hash = h->hash_func(key) % NBUCKETS; | hash = h->hash_func(key) % NBUCKETS; | |||
if (!(e = hash_scan(h, hash, key))) | if (!hash_scan(h, hash, key)) | |||
return false; | return false; | |||
return true; | return true; | |||
} | } | |||
void* hashmap_remove(Hashmap *h, const void *key) { | void* hashmap_remove(Hashmap *h, const void *key) { | |||
struct hashmap_entry *e; | struct hashmap_entry *e; | |||
unsigned hash; | unsigned hash; | |||
void *data; | void *data; | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 9 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |