On Thu, 3 Aug 2006 19:15:15 -0700
"Nate Diller" <[email protected]> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]