X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flist.h;h=2991f46a1fed17d0ec36cbf5e7cc750deaee17e4;hb=e5c13f94058aedcea95236a9728093fa283d49b3;hp=ff39710b1dec75761b98a66e2605f824aceaa5a4;hpb=3f9b53a4a214a254bb27ed30994faf2a0fd12375;p=wimlib diff --git a/src/list.h b/src/list.h index ff39710b..2991f46a 100644 --- a/src/list.h +++ b/src/list.h @@ -163,6 +163,29 @@ static inline void list_transfer(struct list_head *old, } } +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + list_del(list); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + list_del(list); + list_add_tail(list, head); +} + /** * list_splice_tail - join two lists, each list being a queue * @list: the new list to add.