diff options
author | Zebediah Figura <zfigura@codeweavers.com> | 2021-09-12 00:08:59 +0300 |
---|---|---|
committer | Giovanni Mascellani <gmascellani@codeweavers.com> | 2022-07-26 15:48:50 +0300 |
commit | 9386e2034e15ee64a57719cdbbb3489bd4217c42 (patch) | |
tree | 3b4a0e9e1242c8c28c44dfc037453ee9d1ba5438 | |
parent | f343e08464820bacb2bc869c015c59e8d1219d0c (diff) |
include: Add list_move_after() and list_move_before().
-rw-r--r-- | include/private/list.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/private/list.h b/include/private/list.h index b4d681fe..5e92cfb2 100644 --- a/include/private/list.h +++ b/include/private/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) |