chashmap · Section 3
chashmap_reset
NAME
chashmap_reset - clear all elements from the hash map
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/chashmap.h> ccol_retval chashmap_reset(chmap chm, size_t new_bucket_array_size);
DESCRIPTION
Removes every key-value pair from the hash map, destroys all internal data and, if asked, resizes the bucket/slot array. The map is usable after the reset whether the resize succeeded or not.
PARAMETERS
chm Hash map to reset
new_bucket_array_size New bucket count (0 = keep current size;
values < 16 are raised to 16; otherwise
rounded up to the next power of two)
RETURN VALUE
ccol_success - Every element was cleared (and the resize, if
asked for, succeeded)
ccol_not_enough_memory - The resize failed, but the elements are cleared
anyway
NOTES
O(n) complexity, where n is the number of elements Every element is destroyed whatever the return value is Asserts if chm is NULL