hashmap: Add pa_hashmap_remove_all()

Slightly nicer than using pa_hashmap_steal_first() in a loop.
This commit is contained in:
Tanu Kaskinen 2013-02-12 21:36:56 +02:00
parent 061878b5a4
commit 31ee1a7d54
7 changed files with 23 additions and 22 deletions

View file

@ -339,12 +339,10 @@ int pa_database_unset(pa_database *database, const pa_datum *key) {
int pa_database_clear(pa_database *database) {
simple_data *db = (simple_data*)database;
entry *e;
pa_assert(db);
while ((e = pa_hashmap_steal_first(db->map)))
free_entry(e);
pa_hashmap_remove_all(db->map, (pa_free_cb_t) free_entry);
return 0;
}