[pulseaudio-discuss] [PATCH next v0 7/8] bluetooth: Use transport array instead of hashmap for devices

Mikel Astiz mikel.astiz.oss at gmail.com
Wed Dec 5 23:45:15 PST 2012


Hi Tanu,

On Thu, Dec 6, 2012 at 5:31 AM, Tanu Kaskinen <tanuk at iki.fi> wrote:
> On Wed, 2012-12-05 at 17:23 +0100, Mikel Astiz wrote:
>> @@ -169,13 +168,15 @@ static void device_free(pa_bluetooth_device *d) {
>>
>>      pa_assert(d);
>>
>> -    while ((t = pa_hashmap_steal_first(d->transports))) {
>> +    for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i ++) {
>
> Extra space in "i ++".
>
>> +        if ((t = d->transports[i]) == NULL)
>
> !pointer instead of pointer == NULL.
>
>>  pa_bluetooth_transport* pa_bluetooth_device_get_transport(pa_bluetooth_device *d, enum profile profile) {
>> -    pa_bluetooth_transport *t;
>> -    void *state = NULL;
>> -
>>      pa_assert(d);
>>
>> -    while ((t = pa_hashmap_iterate(d->transports, &state, NULL)))
>> -        if (t->profile == profile)
>> -            return t;
>> +    if (profile == PROFILE_OFF)
>> +        return NULL;
>>
>> -    return NULL;
>> +    return d->transports[profile];
>>  }
>
> This whole function is now redundant, because module-blueooth-device can
> just directly look up the transport from d->transports. The only extra
> thing that this function does is that it returns NULL for PROFILE_OFF,
> but that feature is not needed by module-bluetooth-device.

This is exactly what the next patch did.

I will update and submit the patches according to your review and then
you can consider if these two patches need to be squashed.

Thank you,
Mikel


More information about the pulseaudio-discuss mailing list