X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fclists.h;h=17d2201793b6b250f5c03e8465bc39dd358580b1;hb=342e0c3edeacf4eecd03da36c879ca817c64a0f3;hp=2be40881854318db27e49497643ed69d9ee6c7ba;hpb=1cf8ac51f5495ccd5187dc220ffc69e95d6e0cfc;p=libucw.git diff --git a/ucw/clists.h b/ucw/clists.h index 2be40881..17d22017 100644 --- a/ucw/clists.h +++ b/ucw/clists.h @@ -189,6 +189,17 @@ static inline void clist_insert_list_after(clist *what, cnode *after) } } +/** + * Move all items from a source list to a destination list. The source list + * becomes empty, the original contents of the destination list are destroyed. + **/ +static inline void clist_move(clist *to, clist *from) +{ + clist_init(to); + clist_insert_list_after(from, &to->head); + clist_init(from); +} + /** * Compute the number of nodes in @l. Beware linear time complexity. **/