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.
This commit is contained in:
Tanu Kaskinen 2014-08-17 14:52:29 +03:00
parent 97d9f4c5dd
commit facfd3a664

View file

@ -3218,21 +3218,21 @@ static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
} }
/* Compare the elements of each set... */ /* Compare the elements of each set... */
ea = p->elements; PA_LLIST_FOREACH(ea, p->elements) {
eb = p2->elements; bool found_matching_element = false;
while (is_subset) { if (!is_subset)
if (!ea && !eb)
break; break;
else if ((ea && !eb) || (!ea && eb))
is_subset = false; PA_LLIST_FOREACH(eb, p2->elements) {
else if (pa_streq(ea->alsa_name, eb->alsa_name)) { if (pa_streq(ea->alsa_name, eb->alsa_name)) {
if (element_is_subset(ea, eb, m)) { found_matching_element = true;
ea = ea->next; is_subset = element_is_subset(ea, eb, m);
eb = eb->next; break;
} else }
is_subset = false; }
} else
if (!found_matching_element)
is_subset = false; is_subset = false;
} }