C Collections

chashmap · Section 3

chmap_destroy

chmap_destroy - destroy a hash map and set pointer to NULL

C Collections (libccollections, -lccollections)

#include <ccollections/chashmap.h>
 
chmap_destroy(hm);

Frees everything the hash map holds, all key-value pairs included, and
then sets the hash map pointer to NULL.
 
This is the name the type-inferred macro layer uses for chashmap_destroy(3). It
behaves the same way.

hm   Hash map to destroy (set to NULL after destruction)

Safe to call with a NULL pointer
Frees all keys and values
Frees every bucket collision chain and the bucket/slot array itself
 
The macro evaluates hm exactly once. It must be a modifiable lvalue,
such as a variable or an array element, and an expression with a side
effect such as handles[i++] destroys and clears exactly one element.

chashmap_destroy(3), chashmap_create(3), chashmap_destroy_with_dtor(3)