Module: wine
Branch: master
Commit: 099f84c4f07b67b63ff047dc230b916d565d1a9e
URL: https://gitlab.winehq.org/wine/wine/-/commit/099f84c4f07b67b63ff047dc230b91…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Tue Aug 30 21:37:32 2022 +0200
include: Add list_move_after() and list_move_before().
Cherry-picked from vkd3d commit a2996c2d59b140a0a92efc85d43c8f9b59540a12.
---
include/wine/list.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/include/wine/list.h b/include/wine/list.h
index b4d681fe0f3..5e92cfb253c 100644
--- a/include/wine/list.h
+++ b/include/wine/list.h
@@ -150,8 +150,8 @@ static inline unsigned int list_count( const struct list *list )
return count;
}
-/* move all elements from src to the tail of dst */
-static inline void list_move_tail( struct list *dst, struct list *src )
+/* move all elements from src to before the specified element */
+static inline void list_move_before( struct list *dst, struct list *src )
{
if (list_empty(src)) return;
@@ -162,8 +162,8 @@ static inline void list_move_tail( struct list *dst, struct list *src )
list_init(src);
}
-/* move all elements from src to the head of dst */
-static inline void list_move_head( struct list *dst, struct list *src )
+/* move all elements from src to after the specified element */
+static inline void list_move_after( struct list *dst, struct list *src )
{
if (list_empty(src)) return;
@@ -174,6 +174,18 @@ static inline void list_move_head( struct list *dst, struct list *src )
list_init(src);
}
+/* move all elements from src to the head of dst */
+static inline void list_move_head( struct list *dst, struct list *src )
+{
+ list_move_after( dst, src );
+}
+
+/* move all elements from src to the tail of dst */
+static inline void list_move_tail( struct list *dst, struct list *src )
+{
+ list_move_before( dst, src );
+}
+
/* iterate through the list */
#define LIST_FOR_EACH(cursor,list) \
for ((cursor) = (list)->next; (cursor) != (list); (cursor) = (cursor)->next)