mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 13:29:59 -05:00
hashmap: Add pa_hashmap_remove_and_free()
This commit is contained in:
parent
36f775482f
commit
14e2553185
2 changed files with 20 additions and 0 deletions
|
|
@ -207,6 +207,19 @@ void* pa_hashmap_remove(pa_hashmap *h, const void *key) {
|
|||
return data;
|
||||
}
|
||||
|
||||
int pa_hashmap_remove_and_free(pa_hashmap *h, const void *key) {
|
||||
void *data;
|
||||
|
||||
pa_assert(h);
|
||||
|
||||
data = pa_hashmap_remove(h, key);
|
||||
|
||||
if (data && h->value_free_func)
|
||||
h->value_free_func(data);
|
||||
|
||||
return data ? 0 : -1;
|
||||
}
|
||||
|
||||
void pa_hashmap_remove_all(pa_hashmap *h) {
|
||||
pa_assert(h);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue