Name
echash_delete — This function removes an item from the hash table and calls the specified keyfree and datafree functions
Synopsis
#include "echash.h"
| int **echash_delete** (
| ht, | |
| | k, | |
| | klen, | |
| | keyfree, | |
| | datafree)
; | |
ec_hash_table * <var class="pdparam">ht</var>
;
const char * <var class="pdparam">k</var>
;
int <var class="pdparam">klen</var>
;
ECHashFreeFunc <var class="pdparam">keyfree</var>
;
ECHashFreeFunc <var class="pdparam">datafree</var>
;
Description
Remove an item from a hash table and call the keyfree and datafree functions passed in.
- ht
-
The hash table.
- k
-
The key to the item that you wish to remove.
- klen
-
The length of the key.
- keyfree
-
A pointer to the hash table keys function.
- datafree
-
A pointer to the hash table data function.
Note
If you wish to use the ECHashFreeFunc
functions passed in when the hash table was created, use echash_delete_item instead of this function.
The keyfree and datafree functions are optional. If they do not exist, no function is invoked when data or keys are freed.
On success this function returns 1
and on failure 0
.
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.