[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.58.0608071733330.27060@gandalf.stny.rr.com>
Date: Mon, 7 Aug 2006 17:37:50 -0400 (EDT)
From: Steven Rostedt <rostedt@...dmis.org>
To: Andrew Morton <akpm@...l.org>
cc: Nate Diller <nate.diller@...il.com>, axboe@...e.de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -mm] [2/3] add list_merge to list.h
On Thu, 3 Aug 2006, Andrew Morton wrote:
> On Thu, 3 Aug 2006 19:15:15 -0700
> "Nate Diller" <nate.diller@...il.com> wrote:
>
> > +/**
> > + * list_merge - merge two headless lists
> > + * @list: the new list to merge.
> > + * @head: the place to add it in the first list.
> > + *
> > + * This is similar to list_splice(), except it merges every item onto @list,
> > + * not excluding @head itself. It is a noop if @head already immediately
> > + * preceeds @list.
>
> "precedes"
>
> > + */
> > +static inline void list_merge(struct list_head *list, struct list_head *head)
> > +{
> > + struct list_head *last = list->prev;
> > + struct list_head *at = head->next;
> > +
> > + list->prev = head;
> > + head->next = list;
> > +
> > + last->next = at;
> > + at->prev = last;
> > +}
>
> Interesting. I didn't realise that none of the existing functions could do
> this. I wonder if we can flesh the comment out a bit: define "headless" a
> little more verbosely.
>
> Should we call it list_splice_headless() or something? list_merge is a bit
> vague.
>
Yes, please do explicitly mention headless. I could see someone using
this for something with a head and causing some strange bugs.
Also, it might be a good idea to get rid of the "head" in the parameter.
Perhaps call it "start" or something else. It's a little confusing to
have a headless list operation that calls the start of a list "head".
-- Steve
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists