Stefan Dösinger : wine/list.h: Added list_move_head and list_move_tail.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Dec 6 05:49:06 CST 2006


Module: wine
Branch: master
Commit: 3d8cdfb190880b511cc56254a48eceb926b51a09
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3d8cdfb190880b511cc56254a48eceb926b51a09

Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date:   Mon Dec  4 16:12:58 2006 +0100

wine/list.h: Added list_move_head and list_move_tail.

---

 include/wine/list.h |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/wine/list.h b/include/wine/list.h
index 6ceef8c..a0b37cc 100644
--- a/include/wine/list.h
+++ b/include/wine/list.h
@@ -139,6 +139,30 @@ inline static void list_init( struct lis
     list->next = list->prev = list;
 }
 
+/* move all elements from src to the tail of dst */
+inline static void list_move_tail( struct list *dst, struct list *src )
+{
+    if (list_empty(src)) return;
+
+    dst->prev->next = src->next;
+    src->next->prev = dst->prev;
+    dst->prev = src->prev;
+    src->prev->next = dst;
+    list_init(src);
+}
+
+/* move all elements from src to the head of dst */
+inline static void list_move_head( struct list *dst, struct list *src )
+{
+    if (list_empty(src)) return;
+
+    dst->next->prev = src->prev;
+    src->prev->next = dst->next;
+    dst->next = src->next;
+    src->next->prev = dst;
+    list_init(src);
+}
+
 /* iterate through the list */
 #define LIST_FOR_EACH(cursor,list) \
     for ((cursor) = (list)->next; (cursor) != (list); (cursor) = (cursor)->next)




More information about the wine-cvs mailing list