Hi,
On Wed, 25 Sep 2002, Rik van Riel wrote:
> > +#define INIT_SLIST_HEAD(name) \
> > + (name->next = name)
> > +
> > +#define SLIST_HEAD(type,name) \
> > + typeof(type) name = INIT_SLIST_HEAD(name)
>
> Fun, so the list head points to itself ...
>
> > +#define slist_for_each(pos, head) \
> > + for (pos = head; pos && ({ prefetch(pos->next); 1; }); \
> > + pos = pos->next)
>
> ... imagine what that would do in combination with this macro.
I'm aware of that possibility. What would you initialize it to, if not the
list itself? (And BTW, anyone have a solution for slist_add()?)
We could set it to NULL, but where would we end?
#define INIT_SLIST_HEAD(name) \
(name->next = NULL)
#define SLIST_HEAD_INIT(name) name
Thunder
-- assert(typeof((fool)->next) == typeof(fool)); /* wrong */- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon Sep 30 2002 - 22:00:25 EST