summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-06-17 03:15:36 +0200
committerLennart Poettering <lennart@poettering.net>2009-06-17 03:15:36 +0200
commit325c01bdbc00ad3fcec3982164b100a0bc382109 (patch)
tree742996145ed2a03c68f860cc7c4b2decac1dcaa3 /src
parentdda0f5a71ac669a304dd73c7de5cb0bc6ee7a75d (diff)
card: some modernizations
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/card.c16
-rw-r--r--src/pulsecore/card.h2
2 files changed, 8 insertions, 10 deletions
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;