[vlc-devel] [PATCH 1/9] vlc_list: add a typedef vlc_list_node to clarify which is the list and which is the node

Steve Lhomme robux4 at ycbcr.xyz
Mon Aug 20 09:16:39 CEST 2018

On 17/08/2018 19:15, RĂ©mi Denis-Courmont wrote:
> By design, you cannot distinguish list nodes and list heads types in 
> circular list implementations.

I was under the impression vlc_list is an implementation of "intrusive 
lists" not that it's a circular list. The names "intrusive" or 
"intrusion" are not anywhere in the code so I might be wrong.

As an intrusive list (forget what follows if that's not the case) the 
intrusion needs to be documented and taken care of very carefully. 
Having a field in a structure "vlc_list node" does not say anything 
about it. If you receive pointers to such a struct are you allowed to 
list them using a vlc_list ? The answer is probably no. So it should 
explicitly say who is allowed to modify the "node" field. In most cases 
that's one particular vlc_list list (currently all cases).

This is no different that using pointers and knowing who is allowed to 
set it and free it. One would not reuse the same pointer field for 
completely unrelated allocations.

> This series is counter-sensical.

You mean clarifying things for me makes less sense for you ?

> And there are no issues when using the helpers, so I do not see what 
> this solves even.

I can already find a person who had issues with the helpers: me.

More information about the vlc-devel mailing list