[PATCH] alsa-ucm: Make combination port names deterministic

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

 



Am 17.09.2013 14:28, schrieb Arun Raghavan:
>>> +    const pa_alsa_ucm_device *d1 = *(pa_alsa_ucm_device **)a;
>>> +    const pa_alsa_ucm_device *d2 = *(pa_alsa_ucm_device **)b;
>>> +
>>> +    return strcmp(pa_proplist_gets(d1->proplist, PA_ALSA_PROP_UCM_NAME), pa_proplist_gets(d2->proplist, PA_ALSA_PROP_UCM_NAME));
>>> +}
>>> +
>>>   static void ucm_add_port_combination(
>>>           pa_hashmap *hash,
>>>           pa_alsa_ucm_mapping_context *context,
>>> @@ -687,9 +695,16 @@ static void ucm_add_port_combination(
>>>       char *name, *desc;
>>>       const char *dev_name;
>>>       const char *direction;
>>> -    pa_alsa_ucm_device *dev;
>>> +    pa_alsa_ucm_device *sorted[num], *dev;
>>> +
>>> +    for (i = 0; i < num; i++)
>>> +        sorted[i] = pdevices[i];
>> Couldn't we use memcpy() here which would possibly be faster?
> I prefer the readability of doing it explicitly in
> non-performance-sensitive code.
>


I find memcpy() most readable. In contrast, such a loop makes me wonder 
if there is a reason for not doing memcpy() here (causing confusion 
instead of improving readability).

Best regards.


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

  Powered by Linux