]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/clists.h
bgets_mp(): Added a non-intuitive warning to documentation.
[libucw.git] / ucw / clists.h
index d327479fdd8924f2807b0c94bb26d75e6ac84376..809c480dea4303820edce351ad0dfc518931a3fb 100644 (file)
@@ -2,6 +2,7 @@
  *     UCW Library -- Circular Linked Lists
  *
  *     (c) 2003--2010 Martin Mares <mj@ucw.cz>
+ *     (c) 2017 Pavel Charvat <pchar@ucw.cz>
  *
  *     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.