From c43097382a9af8d5ba4a32ecaef9392efb1d70d5 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 29 Dec 2007 18:48:41 +0100 Subject: [PATCH] Added clist_remove_head() and clist_remove_tail(). --- lib/clists.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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; -- 2.39.2