mirror of
https://github.com/upa/mscp.git
synced 2026-02-19 04:55:44 +08:00
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.
This commit is contained in:
26
src/list.h
26
src/list.h
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user