diff options
Diffstat (limited to 'src/list.h')
-rw-r--r-- | src/list.h | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -208,6 +208,32 @@ static inline void list_splice(struct list_head *list, struct list_head *head) __list_splice(list, head); } +static inline void __list_splice_tail(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->prev; + + first->prev = at; + at->next = first; + + last->next = head; + at->prev = last; +} + +/** + * list_splice_tail - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice_tail(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice_tail(list, head); +} + + /** * list_splice_init - join two lists and reinitialise the emptied list. * @list: the new list to add. |