diff options
author | Ryo Nakamura <upa@haeena.net> | 2023-02-25 22:17:29 +0900 |
---|---|---|
committer | Ryo Nakamura <upa@haeena.net> | 2023-02-25 22:17:29 +0900 |
commit | 1be9b70808ca235cd784d66efa92ecd2ce8c4e86 (patch) | |
tree | 77dd580ffb3749c8bd8aeb45f5603afabb866d4a /src/list.h | |
parent | b4c021c954866aade1ea893b04f307afa7295bd7 (diff) |
start to impliment mscp as a library
this commit starts to refactor file.h|c to path.h|c and
add mscp.c|h. not completed yet.
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. |