From: Martin Mares Date: Mon, 9 Feb 2009 20:02:41 +0000 (+0100) Subject: LibUCW: Added a function for assigning lists. X-Git-Tag: holmes-import~112 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a6494a70ff56b4cfa172f9a4ec136338786478bc;p=libucw.git LibUCW: Added a function for assigning lists. --- 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. **/