]> code.delx.au - pulseaudio/commitdiff
card: some modernizations
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Jun 2009 01:15:36 +0000 (03:15 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 17 Jun 2009 01:15:36 +0000 (03:15 +0200)
src/pulsecore/card.c
src/pulsecore/card.h

index 9c16ef2dee4c5046a33d2789563a39c096a39a9d..5a4f01bd4da08c52278c099d9e75eaf5c2069e4b 100644 (file)
@@ -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);
     }
index 415ab6781bdfb28449e1480f3e5686f152203d07..aacb24da43f606a5d7234a074f1f9aad25115eed 100644 (file)
@@ -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;