DynMap struct
#include <bedrock/dynmap.h>
Generic dynamic hash map with separate chaining.
Stores key-value pairs in an array of buckets. Collisions are resolved via linked lists. Optional user-supplied hash, compare, copy, and destroy callbacks manage key and value lifetime. An optional mutex is available when built with DYNMAP_THREAD_SAFE.
Public variables
- size_t num_buckets
- Number of hash buckets currently allocated.
- size_t num_entries
- Number of key-value entries currently stored.
- struct DynMapEntry** buckets
- Array of bucket heads (linked lists of entries).
- unsigned long(* hash
- Hash function for keys.
- int(* compare
- Key comparison; 0 means equal.
- void*(* key_copy
- Copies a key for ownership by the map.
- void(* key_destroy
- Destroys a key owned by the map.
- void*(* value_copy
- Copies a value for ownership by the map.
- void(* value_destroy
- Destroys a value owned by the map.