Data Structures | |
struct | di_hash_table |
Hash table. More... | |
struct | di_hash_node |
Node of a hash table. More... | |
Defines | |
#define | HASH_TABLE_RESIZE(hash_table) |
#define | HASH_TABLE_MIN_SIZE 11 |
#define | HASH_TABLE_MAX_SIZE 13845163 |
#define | CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) |
Functions | |
di_hash_table * | di_hash_table_new (di_hash_func hash_func, di_equal_func key_equal_func) |
di_hash_table * | di_hash_table_new_full (di_hash_func hash_func, di_equal_func key_equal_func, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func) |
void | di_hash_table_destroy (di_hash_table *hash_table) |
void | di_hash_table_insert (di_hash_table *hash_table, void *key, void *value) |
void * | di_hash_table_lookup (di_hash_table *hash_table, const void *key) |
void | di_hash_table_foreach (di_hash_table *hash_table, di_hfunc *func, void *user_data) |
di_ksize_t | di_hash_table_size (di_hash_table *hash_table) |
void | internal_di_hash_table_resize (di_hash_table *hash_table) |
di_hash_node ** | internal_di_hash_table_lookup_node (di_hash_table *hash_table, const void *key) |
di_hash_node * | internal_di_hash_node_new (di_hash_table *hash_table, void *key, void *value) |
void | internal_di_hash_node_destroy (di_hash_node *hash_node, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func) __attribute__((unused)) |
void | internal_di_hash_nodes_destroy (di_hash_node *hash_node, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func) |
|
For internal use only.
|
|
For internal use only. The maximal hash table size |
|
For internal use only. The minimal hash table size |
|
Value:
For internal use only. Defines if a resize is necessary
|
|
Destroys the di_hash_table. If keys and/or values are dynamically allocated, you should either free them first or create the di_hash_table using di_hash_table_new_full. In the latter case the destroy functions you supplied will be called on all keys and values before destroying the di_hash_table.
|
|
Calls the given function for each of the key/value pairs in the di_hash_table. The function is passed the key and value of each pair, and the given user_data parameter.
|
|
Inserts a new key and value into a di_hash_table. If the key already exists in the di_hash_table its current value is replaced with the new value. If you supplied a value_destroy_func when creating the di_hash_table, the old value is freed using that function. If you supplied a key_destroy_func when creating the di_hash_table, the passed key is freed using that function.
|
|
Looks up a key in a di_hash_table.
|
|
Creates a new di_hash_table.
|
|
Creates a new di_hash_table like di_hash_table_new and allows to specify functions to free the memory allocated for the key and value that get called when removing the entry from the di_hash_table
|