[vlc-devel] [PATCH] audio_output: use vlc_list to keep the list of plugged devices
Steve Lhomme
robux4 at ycbcr.xyz
Tue Nov 24 07:32:32 CET 2020
On 2020-11-23 21:16, Rémi Denis-Courmont wrote:
>> @@ -119,9 +121,8 @@ static void aout_HotplugNotify (audio_output_t *aout,
>> dev = malloc (sizeof (*dev) + strlen (id));
>> if (unlikely(dev == NULL))
>> goto out;
>> - dev->next = NULL;
>> strcpy (dev->id, id);
>> - *pp = dev;
>> + vlc_list_prepend(&dev->node, &owner->dev.list);
>
> *append* to preserve order.
>
> Yes the current code effectively prepends, but that's only to save one pointer
> per audio output. That "benefit" is lost when using vlc_list.
I realize it was an append after sending the patch. Usually lists
setting the new pointer would put the element at the front and set the
next to the previous front. That's not the case here.
Is that benefit worth some more readability ? (using more fields was one
one my points against vlc_list but it's not that much in most cases)
>> owner->dev.count++;
>> }
>> else /* Modified device */
>
> --
> Rémi Denis-Courmont
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list