X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fclists.h;h=846752fcce3cd9b2ada471e2208fb86c1dea082d;hb=ff36b07f44efa12a78809ee05bd6d0c25fc60495;hp=aed8028a53f9603e851a8cf8b074f80963de6fbb;hpb=608c1899dbff7471a870491295d38809e2d650ac;p=libucw.git diff --git a/lib/clists.h b/lib/clists.h index aed8028a..846752fc 100644 --- a/lib/clists.h +++ b/lib/clists.h @@ -1,14 +1,14 @@ /* - * Sherlock Library -- Circular Linked Lists + * UCW Library -- Circular Linked Lists * - * (c) 2003 Martin Mares + * (c) 2003--2005 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. */ -#ifndef _SHERLOCK_CLISTS_H -#define _SHERLOCK_CLISTS_H +#ifndef _UCW_CLISTS_H +#define _UCW_CLISTS_H typedef struct cnode { struct cnode *next, *prev; @@ -45,6 +45,8 @@ static inline int clist_empty(clist *l) #define CLIST_WALK(n,list) for(n=(void*)(list).head.next; (cnode*)(n) != &(list).head; n=(void*)((cnode*)(n))->next) #define CLIST_WALK_DELSAFE(n,list,tmp) for(n=(void*)(list).head.next; tmp=(void*)((cnode*)(n))->next, (cnode*)(n) != &(list).head; n=(void*)tmp) +#define CLIST_FOR_EACH(type,n,list) for(type n=(void*)(list).head.next; (cnode*)(n) != &(list).head; n=(void*)((cnode*)(n))->next) +#define CLIST_FOR_EACH_DELSAFE(type,n,list,tmp) for(type n=(void*)(list).head.next; tmp=(void*)((cnode*)(n))->next, (cnode*)(n) != &(list).head; n=(void*)tmp) static inline void clist_insert_after(cnode *what, cnode *after) {