]> mj.ucw.cz Git - libucw.git/commitdiff
Added clist_remove_head() and clist_remove_tail().
authorMartin Mares <mj@ucw.cz>
Sat, 29 Dec 2007 17:48:41 +0000 (18:48 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 29 Dec 2007 17:48:41 +0000 (18:48 +0100)
lib/clists.h

index 4f1848d8d2fc903a9327cab05df40c444df6a171..8b67608c8fb9e15be4dfb6a0bfeae87cb38d3f33 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     UCW Library -- Circular Linked Lists
  *
- *     (c) 2003--2005 Martin Mares <mj@ucw.cz>
+ *     (c) 2003--2007 Martin Mares <mj@ucw.cz>
  *
  *     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;