hashmap: Use pa_free_cb_t instead of pa_free2_cb_t

The previous patch removed module-gconf's dependency on the userdata
pointer of the free callback, and that was the only place where the
userdata pointer of pa_free2_cb_t was used, so now there's no need for
pa_free2_cb_t in pa_hashmap_free(). Using pa_free_cb_t instead allows
removing a significant amount of repetitive code.
This commit is contained in:
Tanu Kaskinen 2013-02-12 21:36:53 +02:00
parent dcf043842e
commit 8872c238ba
41 changed files with 112 additions and 308 deletions

View file

@ -56,8 +56,10 @@ static void device_port_free(pa_object *o) {
if (p->proplist)
pa_proplist_free(p->proplist);
if (p->profiles)
pa_hashmap_free(p->profiles, NULL, NULL);
pa_hashmap_free(p->profiles, NULL);
pa_xfree(p->name);
pa_xfree(p->description);
pa_xfree(p);
@ -88,14 +90,9 @@ pa_device_port *pa_device_port_new(pa_core *c, const char *name, const char *des
}
void pa_device_port_hashmap_free(pa_hashmap *h) {
pa_device_port *p;
pa_assert(h);
while ((p = pa_hashmap_steal_first(h)))
pa_device_port_unref(p);
pa_hashmap_free(h, NULL, NULL);
pa_hashmap_free(h, (pa_free_cb_t) pa_device_port_unref);
}
void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset) {