Add hashtable_contains()
This commit is contained in:
parent
23cb773630
commit
17edf15cbd
|
@ -79,6 +79,11 @@ static hashtable_entry_t **hashtable_find(hashtable_t *table, cmsg_bytes_t key)
|
|||
return entryptr;
|
||||
}
|
||||
|
||||
int hashtable_contains(hashtable_t *table, cmsg_bytes_t key) {
|
||||
hashtable_entry_t **entryptr = hashtable_find(table, key);
|
||||
return (*entryptr != NULL);
|
||||
}
|
||||
|
||||
int hashtable_get(hashtable_t *table, cmsg_bytes_t key, void **valueptr) {
|
||||
hashtable_entry_t **entryptr = hashtable_find(table, key);
|
||||
if (*entryptr == NULL) {
|
||||
|
|
|
@ -25,6 +25,7 @@ extern void init_hashtable(hashtable_t *table,
|
|||
void (*free_value)(void *));
|
||||
extern void destroy_hashtable(hashtable_t *table);
|
||||
|
||||
extern int hashtable_contains(hashtable_t *table, cmsg_bytes_t key);
|
||||
extern int hashtable_get(hashtable_t *table, cmsg_bytes_t key, void **valueptr);
|
||||
extern int hashtable_put(hashtable_t *table, cmsg_bytes_t key, void *value);
|
||||
extern int hashtable_erase(hashtable_t *table, cmsg_bytes_t key);
|
||||
|
|
Loading…
Reference in New Issue