lkml.org 
[lkml]   [2002]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][2.5] Single linked lists for Linux, overly complicated v2
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/

\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.042 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site