X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fslists.h;h=1325c12376878974f74d682e599d396b6f792654;hb=0053f1a862cd0c2f359a4d12f0fdd35b17d18906;hp=5c6d29f93721ea256bd6b66efb2d57d457c891b1;hpb=a4fe009d3366b0a3e119713b0ecc7fc0070efdfa;p=libucw.git diff --git a/ucw/slists.h b/ucw/slists.h index 5c6d29f9..1325c123 100644 --- a/ucw/slists.h +++ b/ucw/slists.h @@ -10,6 +10,12 @@ #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;