mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Nate Diller" <nate.diller@gmail.com>
Cc: axboe@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm] [2/3] add list_merge to list.h
Date: Thu, 3 Aug 2006 22:22:04 -0700	[thread overview]
Message-ID: <20060803222204.f369e6da.akpm@osdl.org> (raw)
In-Reply-To: <5c49b0ed0608031915g2c1fc44ch623a7657b994bf9c@mail.gmail.com>

On Thu, 3 Aug 2006 19:15:15 -0700
"Nate Diller" <nate.diller@gmail.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.


  reply	other threads:[~2006-08-04  5:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-04  2:15 Nate Diller
2006-08-04  5:22 ` Andrew Morton [this message]
2006-08-07 21:37   ` Steven Rostedt
2006-08-04 18:03 ` Ben Pfaff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060803222204.f369e6da.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nate.diller@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome