From 325c01bdbc00ad3fcec3982164b100a0bc382109 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 17 Jun 2009 03:15:36 +0200 Subject: card: some modernizations --- src/pulsecore/card.c | 16 +++++++--------- src/pulsecore/card.h | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c index 9c16ef2d..5a4f01bd 100644 --- a/src/pulsecore/card.c +++ b/src/pulsecore/card.c @@ -148,15 +148,12 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { c->save_profile = data->save_profile; if (!c->active_profile && c->profiles) { - void *state = NULL; + void *state; pa_card_profile *p; - while ((p = pa_hashmap_iterate(c->profiles, &state, NULL))) { - if (!c->active_profile || - p->priority > c->active_profile->priority) - + PA_HASHMAP_FOREACH(p, c->profiles, state) + if (!c->active_profile || p->priority > c->active_profile->priority) c->active_profile = p; - } } c->userdata = NULL; @@ -177,7 +174,6 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { void pa_card_free(pa_card *c) { pa_core *core; - pa_card_profile *profile; pa_assert(c); pa_assert(c->core); @@ -200,8 +196,10 @@ void pa_card_free(pa_card *c) { pa_idxset_free(c->sources, NULL, NULL); if (c->profiles) { - while ((profile = pa_hashmap_steal_first(c->profiles))) - pa_card_profile_free(profile); + pa_card_profile *p; + + while ((p = pa_hashmap_steal_first(c->profiles))) + pa_card_profile_free(p); pa_hashmap_free(c->profiles, NULL, NULL); } diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h index 415ab678..aacb24da 100644 --- a/src/pulsecore/card.h +++ b/src/pulsecore/card.h @@ -63,7 +63,7 @@ struct pa_card { pa_hashmap *profiles; pa_card_profile *active_profile; - pa_bool_t save_profile; + pa_bool_t save_profile:1; void *userdata; -- cgit