Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 May 2007 00:07:46 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        John Baldwin <jhb@freebsd.org>
Cc:        freebsd-arch@freebsd.org, Julian Elischer <julian@elischer.org>, Hans Petter Selasky <hselasky@c2i.net>
Subject:   Re: Missing LIST_PREV() ?
Message-ID:  <20070508210745.GA17259@kobe.laptop>
In-Reply-To: <200705081658.38171.jhb@freebsd.org>
References:  <200705051617.34162.hselasky@c2i.net> <4640C52E.7010209@elischer.org> <200705082100.51354.hselasky@c2i.net> <200705081658.38171.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2007-05-08 16:58, John Baldwin <jhb@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?




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070508210745.GA17259>