Re: [PATCH][2.5] Single linked lists for Linux, overly complicated

Rik van Riel (riel@conectiva.com.br)
Thu, 26 Sep 2002 14:53:42 -0300 (BRT)


On Thu, 26 Sep 2002, Andreas Räcker wrote:

> +#define INIT_SLIST_HEAD(name) \
> + (name->next = name)
> +
> +#define SLIST_HEAD_INIT(name) \
> + { .next = NULL; }
> +
> +#define SLIST_HEAD(type,name) \
> + typeof(type) name = SLIST_HEAD_INIT(name)

INIT_SLIST_HEAD still has the old behaviour...

> +#define slist_add_front(_new_in, _head_in) \

> +#define slist_add(_new_in, _head_in) \

These two seem to be exactly the same, surely you only need one ?

> +#define slist_del(_entry_in) \

And what happens when you try to remove an entry from the middle
of the list ?

Also, how do you know which list the entry is removed from ?

> +/**
> + * slist_for_each - iterate over a list
> + * @pos: the pointer to use as a loop counter.
> + * @head: the head for your list (this is also the first entry).
> + */
> +#define slist_for_each(pos, head) \
> + for (pos = head; pos && ({ prefetch(pos->next); 1; }); \
> + pos = pos->next)

Are you sure the list head _can_ be the first entry ?

Not having the head of the list in a known place (ie. a fixed
list head) can make a list very hard to find.

> +/**
> + * slist_for_each_round - iterate over a round list
> + * @pos: the pointer to use as a loop counter.
> + * @head: the head for your list (this is also the first entry).
> + */
> +#define slist_for_each(pos, head) \

You forgot to rename this define.

> --
> Lightweight Patch Manager, without pine.
> If you have any objections (apart from who I am), tell me
^^^^^^^^^^^^^^^^^^^
I guess that's why we have whois ;)

cheers,

Rik

-- 
A: No.
Q: Should I include quotations after my reply?

http://www.surriel.com/ http://distro.conectiva.com/

- 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/