From 20c5b007054f79292abac3d9e982ba148f9b1e26 Mon Sep 17 00:00:00 2001 From: Stefan Doesinger Date: Mon, 27 Nov 2006 12:36:38 +0100 Subject: [PATCH] list_move --- include/wine/list.h | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/include/wine/list.h b/include/wine/list.h index 6ceef8c..dafb374 100644 --- a/include/wine/list.h +++ b/include/wine/list.h @@ -139,6 +139,23 @@ inline static void list_init( struct lis list->next = list->prev = list; } +/* Move all ements from a list to another */ +inline static void list_move(struct list *dst, struct list *src) +{ + struct list *first_src = list_head(src); + struct list *last_src = list_tail(src); + + if(list_empty(src)) return; + + dst->prev->next = first_src; + first_src->prev = dst->prev; + dst->prev = last_src; + last_src->next = dst; + + /* Get the source to a sane state */ + list_init(src); +} + /* iterate through the list */ #define LIST_FOR_EACH(cursor,list) \ for ((cursor) = (list)->next; (cursor) != (list); (cursor) = (cursor)->next) -- 1.4.1.1