Add a get function that can help handle duplicate key entries.
This commit is contained in:
10
include/ht.h
10
include/ht.h
@@ -125,6 +125,16 @@ libds_result ht_put(ht* ht, const void* key, void* value);
|
||||
* @return the data, or NULL if it is not found.
|
||||
*/
|
||||
void* ht_get(ht* ht, const void* key);
|
||||
/**
|
||||
* Retreives the first value from the hash table
|
||||
* that's stored with the given key and passes the compare function.
|
||||
* @param ht the hash table to retreive the value from.
|
||||
* @param key the key to use to find the data.
|
||||
* @param data the data to compare the candidate value to.
|
||||
* @param compare the comparison function used to compare adta.
|
||||
* @return the data, or NULL if it is not found.
|
||||
*/
|
||||
void* ht_get_filter(ht* ht, const void* key, void* data, compare_func compare);
|
||||
/**
|
||||
* Removes a value from the hash table.
|
||||
* @param ht the hash table to remove a value from.
|
||||
|
||||
Reference in New Issue
Block a user