mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-25 02:33:59 +08:00
add list_concat, list_move, list_reverse
This commit is contained in:
@@ -145,6 +145,37 @@ static inline int list_empty(const struct list_head *head)
|
||||
return head->next == head;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_concat - concatenate the entries from a list to another list.
|
||||
* @src: the source list; the entries in the source list will be deleted.
|
||||
* @dest: the destination list.
|
||||
*/
|
||||
static inline void list_concat(struct list_head* dest, struct list_head* src)
|
||||
{
|
||||
while (!list_empty(src)) {
|
||||
struct list_head* entry = src->next;
|
||||
list_del(src->next);
|
||||
list_add_tail(entry, dest);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* list_move - move the entries from a list to another list.
|
||||
* @src: the source list; the entries in the source list will be deleted.
|
||||
* @dest: the destination list, the list will be initialized to empty
|
||||
* before moving the entries.
|
||||
*/
|
||||
static inline void list_move(struct list_head* dest, struct list_head* src)
|
||||
{
|
||||
INIT_LIST_HEAD(dest);
|
||||
|
||||
while (!list_empty(src)) {
|
||||
struct list_head* entry = src->next;
|
||||
list_del(src->next);
|
||||
list_add_tail(entry, dest);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* list_entry - get the struct for this entry
|
||||
* @ptr: the &struct list_head pointer.
|
||||
|
||||
Reference in New Issue
Block a user