summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-08-17 14:52:29 +0300
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-08-18 13:44:44 +0300
commitfacfd3a6644711d32ecfd755d30a351b8ee61620 (patch)
tree81d87f839837476b71da9dc57968f6ba26ad02a3
parent97d9f4c5dd9aa44fdc7bd7e5919b55c285a19f53 (diff)
alsa-mixer: Fix path subset detection
The old logic assumed that if path A was a subset of path B, the element list in B would have all elements of A in the beginning of B's list, in the same order as A. This assumption was invalid, causing some subset cases to not get detected. We need to search through the full element list of B every time before we can conclude that B doesn't have the element that we're inspecting.
-rw-r--r--src/modules/alsa/alsa-mixer.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index b4f4bbd83..48715234a 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -3218,21 +3218,21 @@ static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
}
/* Compare the elements of each set... */
- ea = p->elements;
- eb = p2->elements;
+ PA_LLIST_FOREACH(ea, p->elements) {
+ bool found_matching_element = false;
- while (is_subset) {
- if (!ea && !eb)
+ if (!is_subset)
break;
- else if ((ea && !eb) || (!ea && eb))
- is_subset = false;
- else if (pa_streq(ea->alsa_name, eb->alsa_name)) {
- if (element_is_subset(ea, eb, m)) {
- ea = ea->next;
- eb = eb->next;
- } else
- is_subset = false;
- } else
+
+ PA_LLIST_FOREACH(eb, p2->elements) {
+ if (pa_streq(ea->alsa_name, eb->alsa_name)) {
+ found_matching_element = true;
+ is_subset = element_is_subset(ea, eb, m);
+ break;
+ }
+ }
+
+ if (!found_matching_element)
is_subset = false;
}