From: Martin Mares Date: Sat, 29 Dec 2007 17:48:41 +0000 (+0100) Subject: Added clist_remove_head() and clist_remove_tail(). X-Git-Tag: holmes-import~476^2~4 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=c43097382a9af8d5ba4a32ecaef9392efb1d70d5;p=libucw.git Added clist_remove_head() and clist_remove_tail(). --- diff --git a/lib/clists.h b/lib/clists.h index 4f1848d8..8b67608c 100644 --- a/lib/clists.h +++ b/lib/clists.h @@ -1,7 +1,7 @@ /* * UCW Library -- Circular Linked Lists * - * (c) 2003--2005 Martin Mares + * (c) 2003--2007 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -86,6 +86,22 @@ static inline void clist_remove(cnode *n) after->prev = before; } +static inline void *clist_remove_head(clist *l) +{ + cnode *n = clist_head(l); + if (n) + clist_remove(n); + return n; +} + +static inline void *clist_remove_tail(clist *l) +{ + cnode *n = clist_tail(l); + if (n) + clist_remove(n); + return n; +} + static inline void clist_init(clist *l) { cnode *head = &l->head;