Re: [TRIVIAL PATCH] Remove list_t infection.

From: J.A. Magallon (jamagallon@able.es)
Date: Wed Sep 04 2002 - 09:36:15 EST


On 2002.09.04 Rusty Russell wrote:
>In message <Pine.LNX.4.44.0209031923290.1513-100000@home.transmeta.com> you wri
>te:
...
>
>I'm confused, but I do know three things:
>
>1) list_t *bad*,
>
>2) Grand renaming of "struct list_head" *bad*, and
>

Why not something like:

struct list_node {
    struct list_node *prev;
    struct list_node *next;
}

struct list {
    struct list_node *prev;
    struct list_node *next;
}
        
list_length(struct list *l)
list_add(struct list_node *new, struct list *head)
list_splice(struct list *list, struct list *head)

New:

#define list_sublist_from(node) ((struct list *)node)

So people would be forced to think if he is using a 'list_head'
as a node or as a sublist, and do the right casts to shut up the
compiler (that's why you can't do a typedef list_node list..., for
the compiler to scream...)

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.0 (Cooker) for i586
Linux 2.4.20-pre5-j0 (gcc 3.2 (Mandrake Linux 9.0 3.2-1mdk))
-
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 : Sat Sep 07 2002 - 22:00:21 EST