Name
echash_create — Create a hash table
Synopsis
#include "echash.h"
| ec_hash_table * **echash_create** (
| keyfree, | |
| | datafree)
; | |
ECHashFreeFunc <var class="pdparam">keyfree</var>
;
ECHashFreeFunc <var class="pdparam">datafree</var>
;
Description
This function creates a hash table by allocating memory of the MEMTYPE_EC_HASH_TABLE
type. Use echash_delete or echash_delete_item to free memory used by hash table entries.
Note
The parameters passed to this function must not be transient buffers, because the hash table implementation does not duplicate them. If ECHashFreeFunc functions are specified upon creation, these functions free up memory when you call echash_delete.
The keyfree and datafree functions are optional. If they do not exist, no function is invoked when data or keys are freed.
- keyfree
-
A pointer to the hash table keys—the ECHashFreeFunc function will allocate and destroy memory. Note: ECHashFreeFunc is defined as folows:
typedef void (*ECHashFreeFunc)(void *);
- datafree
-
A pointer to the hash table data—the ECHashFreeFunc function will allocate and destroy memory.
This function returns an ec_hash_table.
It is legal to call this function in any thread.
The hash table data structure is not thread safe; any simultaneous access needs to be coordinated by the API consumer.