]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/slists.h
Xtypes: Documentation
[libucw.git] / ucw / slists.h
index 5c6d29f93721ea256bd6b66efb2d57d457c891b1..1325c12376878974f74d682e599d396b6f792654 100644 (file)
 #ifndef _UCW_SLISTS_H
 #define _UCW_SLISTS_H
 
+#ifdef CONFIG_UCW_CLEAN_ABI
+#define slist_insert_before ucw_slist_insert_before
+#define slist_prev ucw_slist_prev
+#define slist_remove ucw_slist_remove
+#endif
+
 /**
  * Common header for list nodes.
  **/
@@ -116,9 +122,12 @@ static inline void slist_remove_after(slist *l, snode *after)
 /**
  * Remove the first node in @l. The list can be empty.
  **/
-static inline void slist_remove_head(slist *l)
+static inline void *slist_remove_head(slist *l)
 {
-  slist_remove_after(l, &l->head);
+  snode *n = slist_head(l);
+  if (n)
+    slist_remove_after(l, &l->head);
+  return n;
 }
 
 /* Loops */
@@ -167,9 +176,9 @@ static inline void slist_remove_tail(slist *l)
 /**
  * Compute the number of nodes in @l. Beware linear time complexity.
  **/
-static inline uns slist_size(slist *l)
+static inline uint slist_size(slist *l)
 {
-  uns i = 0;
+  uint i = 0;
   SLIST_FOR_EACH(snode *, n, *l)
     i++;
   return i;