cbstmap · Section 3
cbmap_remove
NAME
cbmap_remove - remove a key-value pair (type-inferred)
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cbstmap.h> ccol_retval cbmap_remove(hm_name, key);
DESCRIPTION
Type-inferred wrapper for cbstmap_remove_elem() that returns its result code. The tree is rebalanced after the delete. The lookup key is converted through the DECLARED key type of the tree, as cbmap_insert(3) converts it, so a key stored through that conversion is found again only by a lookup that makes the same conversion. Both a literal and a computed expression are accepted.
PARAMETERS
hm_name BST map to remove from key Key to remove
RETURN VALUE
ccol_success if the key was removed. ccol_key_not_found if the key is not in the map. ccol_invalid_args if key is a NULL character pointer, which is not a string.
NOTES
ccol_key_not_found doesn't stop the program. The memory of the removed key and value is freed.