[pulseaudio-discuss] [PATCH v5 09/39] bluetooth: Create a function to remove only one adapter object

João Paulo Rechi Vita jprvita at gmail.com
Tue Oct 1 05:52:48 PDT 2013


On Sat, Sep 28, 2013 at 7:07 AM, Tanu Kaskinen
<tanu.kaskinen at linux.intel.com> wrote:
> On Tue, 2013-09-24 at 19:45 -0300, jprvita at gmail.com wrote:
>> @@ -371,11 +398,8 @@ static void adapter_remove_all(pa_bluetooth_discovery *y) {
>>
>>      /* When this function is called all devices have already been freed */
>>
>> -    while ((a = pa_hashmap_steal_first(y->adapters))) {
>> -        pa_xfree(a->path);
>> -        pa_xfree(a->address);
>> -        pa_xfree(a);
>> -    }
>> +    while ((a = pa_hashmap_steal_first(y->adapters)))
>> +        adapter_free(a);
>
> pa_hashmap_remove_all() can be used here (the hashmap initialization
> needs to be changed so that adapter_free is passed to
> pa_hashmap_new_full()). Actually, the whole adapter_remove_all()
> function is now redundant, because it's effectively just an alias for
> pa_hashmap_remove_all().
>

Yes, that's a good improvement, this code was written before the
introduction of this API. There might be other points in the code
where we can change that.

I've now acked the patch where you change this.

-- 
João Paulo Rechi Vita
http://about.me/jprvita


More information about the pulseaudio-discuss mailing list