echash_delete

March 26, 2020 Contributors

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.

Parameters

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.

Return Values

On success this function returns 1 and on failure 0.

Threading

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.

See Also

“ec_hash_table”, echash_delete_item and echash_create