Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 May 2007 12:39:53 +0100
From:      Mark Murray <markm@FreeBSD.ORG>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Missing LIST_PREV() ? 
Message-ID:  <200705061139.l46BdssN017108@greatest.grondar.org>
In-Reply-To: Message from Hans Petter Selasky <hselasky@c2i.net> of "Sun, 06 May 2007 13:04:04 %2B0200." <200705061304.05093.hselasky@c2i.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
Hans Petter Selasky writes:
> Hi,
> 
> Why should LISTs only be forward traversable? The following piece of
> code make lists backward traversable:

No objection to the concept.

But...

> /sys/sys/queue.h:
> 
> +#define LIST_PREV(head,elm,field) \
> +  (((elm) == LIST_FIRST(head)) ? ((__typeof(elm))0) : \
> +   ((__typeof(elm))(((uint8_t *)((elm)->field.le_prev)) - \
> +                   ((uint8_t *)&LIST_NEXT((__typeof(elm))0,field)))))

Please don't use typeof; it is a GCCism. Do you really mean NULL?

M
--
Mark R V Murray - Cert APS(Open) Dip Phys(Open) BSc Open(Open)





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