[pulseaudio-discuss] [RFC PATCH 2/3] alsa: Allow "fallback" configuration for mappings and profiles
David Henningsson
david.henningsson at canonical.com
Sun Jul 27 10:51:13 PDT 2014
On 2014-07-26 06:52, Alexander E. Patrakov wrote:
> 25.07.2014 19:31, David Henningsson wrote:
>> +again:
>> PA_HASHMAP_FOREACH(p, ps->profiles, state) {
> ...
>> }
>> + if (!tryfallback && (profilesfound == 0)) {
>> + tryfallback = true;
>> + goto again;
>> + }
>> +
>
> Ugh. Surely this can be expressed without a goto that goes up? E.g. by
> making a new function and calling it once or twice, depending on whether
> it found any profiles on the first call.
>
> I understand that there is at least one more place in PulseAudio with
> that "change a boolean flag and goto up" idiom, so the criticism may be
> invalid when applied to PulseAudio.
There is more than one way to refactor this function to avoid the goto,
but probably I need to improve this part anyway so I left it that way
for the RFC patch.
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
More information about the pulseaudio-discuss
mailing list