Missing LIST_PREV() ?

Mark Murray mark at grondar.org
Sun May 6 11:40:17 UTC 2007


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)




More information about the freebsd-hackers mailing list