diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2013-02-12 21:36:53 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2013-02-16 01:12:21 +0200 |
commit | 8872c238ba6748c76455ecc6827b83ebcb1dd469 (patch) | |
tree | 1f73094f08088d08ded489f479cbf54ab7769214 /src/pulsecore/card.c | |
parent | dcf043842e6bef0680bb246e7266b7c0829d34d4 (diff) | |
download | pulseaudio-8872c238ba6748c76455ecc6827b83ebcb1dd469.tar.gz |
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.
Diffstat (limited to 'src/pulsecore/card.c')
-rw-r--r-- | src/pulsecore/card.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c index afabc9531..560e36e10 100644 --- a/src/pulsecore/card.c +++ b/src/pulsecore/card.c @@ -57,7 +57,6 @@ pa_card_profile *pa_card_profile_new(const char *name, const char *description, void pa_card_profile_free(pa_card_profile *c) { pa_assert(c); - pa_assert(!c->card); /* Card profiles shouldn't be freed before removing them from the card. */ pa_xfree(c->name); pa_xfree(c->description); @@ -126,14 +125,8 @@ void pa_card_new_data_done(pa_card_new_data *data) { pa_proplist_free(data->proplist); - if (data->profiles) { - pa_card_profile *c; - - while ((c = pa_hashmap_steal_first(data->profiles))) - pa_card_profile_free(c); - - pa_hashmap_free(data->profiles, NULL, NULL); - } + if (data->profiles) + pa_hashmap_free(data->profiles, (pa_free_cb_t) pa_card_profile_free); if (data->ports) pa_device_port_hashmap_free(data->ports); @@ -246,16 +239,8 @@ void pa_card_free(pa_card *c) { pa_device_port_hashmap_free(c->ports); - if (c->profiles) { - pa_card_profile *p; - - while ((p = pa_hashmap_steal_first(c->profiles))) { - p->card = NULL; - pa_card_profile_free(p); - } - - pa_hashmap_free(c->profiles, NULL, NULL); - } + if (c->profiles) + pa_hashmap_free(c->profiles, (pa_free_cb_t) pa_card_profile_free); pa_proplist_free(c->proplist); pa_xfree(c->driver); |