diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-07-12 11:17:04 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-07-13 14:20:49 -0700 |
commit | 4ec8b39fcd8086ff73334dcb31491d907ac08e85 (patch) | |
tree | d0480fbbdc0f5e478a7935ca3ed05e55e79b232d /src/util/hash_table.c | |
parent | a3150c1d06ae7766c3d3fe3b33432e55c3c7527e (diff) |
util/hash_table: add helper to remove entry by key
And the corresponding test case.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/util/hash_table.c')
-rw-r--r-- | src/util/hash_table.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util/hash_table.c b/src/util/hash_table.c index f8d5d0f88aa..7ee9e18a1fc 100644 --- a/src/util/hash_table.c +++ b/src/util/hash_table.c @@ -421,6 +421,15 @@ _mesa_hash_table_remove(struct hash_table *ht, } /** + * Removes the entry with the corresponding key, if exists. + */ +void _mesa_hash_table_remove_key(struct hash_table *ht, + const void *key) +{ + _mesa_hash_table_remove(ht, _mesa_hash_table_search(ht, key)); +} + +/** * This function is an iterator over the hash table. * * Pass in NULL for the first entry, as in the start of a for loop. Note that |