Add a get function that can help handle duplicate key entries.

This commit is contained in:
2018-03-17 16:53:46 -07:00
parent c318aae32c
commit 320c747c2d
2 changed files with 25 additions and 0 deletions

View File

@@ -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.