[vlc-devel] [PATCH 1/3] vlc_list: helpers for doubly linked lists

Romain Vimont rom1v at videolabs.io
Mon Jun 11 19:47:27 CEST 2018


On Mon, Jun 11, 2018 at 08:14:41PM +0300, Rémi Denis-Courmont wrote:
> Le maanantaina 11. kesäkuuta 2018, 18.14.47 EEST Romain Vimont a écrit :
> > On Mon, Jun 11, 2018 at 01:27:12PM +0300, Rémi Denis-Courmont wrote:
> > > I am storing the head so that the head expression is expansion-safe. In
> > > practice, the compiler should be able to optimize it away. Likewise, it
> > > should be able to optimize the constant offset away.
> > Since the offset is compile-time constant, I would not store it at all.
> > 
> > > Point is that an iterator is unavoidable in the general case. With that in
> > > mind, I'd rather leverage the iterator to make the code as safe as
> > > possible.
> > > 
> > > I already replaced goal with head to make the iteration safe against
> > > removal.
> > OK, so you want the safe foreach version only.
> 
> As expected, GCC is perfectly able to optimize the head and the offset:
> [...]

Thank you for the details. I will read this when I have some time.

> I already replaced goal with head to make the iteration safe against removal.

Did you push your current version somewhere?


More information about the vlc-devel mailing list