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

@ -3740,7 +3740,7 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile,
mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL, &hctl_handle);
if (!mixer_handle || !hctl_handle) {
/* Cannot open mixer, remove all entries */
while (pa_hashmap_steal_first(ps->paths));
pa_hashmap_remove_all(ps->paths, NULL);
return;
}

View file

@ -141,8 +141,7 @@ static int get_session_list(struct userdata *u) {
free(sessions);
}
while ((o = pa_hashmap_steal_first(u->previous_sessions)))
free_session(o);
pa_hashmap_remove_all(u->previous_sessions, (pa_free_cb_t) free_session);
return 0;
}