Missing LIST_PREV() ?

Giorgos Keramidas keramida at ceid.upatras.gr
Tue May 8 21:19:27 UTC 2007


On 2007-05-08 16:58, John Baldwin <jhb at freebsd.org> wrote:
> On Tuesday 08 May 2007 03:00:51 pm Hans Petter Selasky wrote:
> > I suggested the following at hacker's:
> >
> > #define LIST_PREV(head,elm,field,type) \
> >  (((elm) == LIST_FIRST(head)) ? ((struct type *)0) : \
> >   ((struct type *)(((uint8_t *)((elm)->field.le_prev)) - \
> >                    ((uint8_t *)&LIST_NEXT((struct type *)0,field)))))
> >
> > What do you think?
>
> Just use a TAILQ, that's what it is there for.

The macro is interesting, but I wouldn't feel safe using it.

I didn't receive the hackers post, but I fully agree.  Please just use
TAILQ.  No pointer-hacks are needed, it's there already, it works as
expected on all the cases I've seen... what more do we need?



More information about the freebsd-arch mailing list