[RFC PATCH 2/3] alsa: Allow "fallback" configuration for mappings and profiles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux