diff -r 8170f658f017 -r 311cac04d079 ucx/dlist.h --- a/ucx/dlist.h Sat Jul 20 11:13:26 2013 +0200 +++ b/ucx/dlist.h Mon Jul 22 11:39:06 2013 +0200 @@ -36,6 +36,22 @@ extern "C" { #endif +/** + * Loop statement for UCX lists. + * + * The first argument is a pointer to the list. In most cases this will be the + * pointer to the first element of the list, but it may also be an arbitrary + * element of the list. The iteration will then start with that element. + * + * The second argument is the name of the iteration variable. The scope of + * this variable is limited to the UCX_FOREACH statement. + * + * @param list The first element of the list + * @param elem The variable name of the element + */ +#define UCX_FOREACH(list,elem) \ + for (UcxDlist* elem = list ; elem != NULL ; elem = elem->next) + typedef struct UcxDlist UcxDlist; struct UcxDlist { void *data;