X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fclists.h;h=809c480dea4303820edce351ad0dfc518931a3fb;hb=a7bae3293ad367903df28054af1e0b9be3d169b5;hp=d327479fdd8924f2807b0c94bb26d75e6ac84376;hpb=ae7dfec55384883a72867d4877b5283a3c1c8aa1;p=libucw.git diff --git a/ucw/clists.h b/ucw/clists.h index d327479f..809c480d 100644 --- a/ucw/clists.h +++ b/ucw/clists.h @@ -2,6 +2,7 @@ * UCW Library -- Circular Linked Lists * * (c) 2003--2010 Martin Mares + * (c) 2017 Pavel Charvat * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -189,6 +190,24 @@ static inline void clist_insert_list_after(clist *what, cnode *after) } } +/** + * Merge two lists by inserting the list @what in front of all other nodes in a different list @l. + * The first list is then cleared. + **/ +static inline void clist_add_list_head(clist *l, clist *what) +{ + clist_insert_list_after(what, &l->head); +} + +/** + * Merge two lists by inserting the list @what after all other nodes in a different list @l. + * The first list is then cleared. + **/ +static inline void clist_add_list_tail(clist *l, clist *what) +{ + clist_insert_list_after(what, l->head.prev); +} + /** * 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.