wine/list.h: Added list_move_head and list_move_tail.

This commit is contained in:
Stefan Dösinger 2006-12-04 16:12:58 +01:00 committed by Alexandre Julliard
parent 13b974bdff
commit 3d8cdfb190
1 changed files with 24 additions and 0 deletions

View File

@ -139,6 +139,30 @@ inline static void list_init( struct list *list )
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)