ucx/dlist.h

changeset 121
311cac04d079
parent 120
8170f658f017
     1.1 --- a/ucx/dlist.h	Sat Jul 20 11:13:26 2013 +0200
     1.2 +++ b/ucx/dlist.h	Mon Jul 22 11:39:06 2013 +0200
     1.3 @@ -36,6 +36,22 @@
     1.4  extern "C" {
     1.5  #endif
     1.6  
     1.7 +/**
     1.8 + * Loop statement for UCX lists.
     1.9 + * 
    1.10 + * The first argument is a pointer to the list. In most cases this will be the
    1.11 + * pointer to the first element of the list, but it may also be an arbitrary
    1.12 + * element of the list. The iteration will then start with that element.
    1.13 + * 
    1.14 + * The second argument is the name of the iteration variable. The scope of
    1.15 + * this variable is limited to the <code>UCX_FOREACH</code> statement.
    1.16 + * 
    1.17 + * @param list The first element of the list
    1.18 + * @param elem The variable name of the element
    1.19 + */
    1.20 +#define UCX_FOREACH(list,elem) \
    1.21 +        for (UcxDlist* elem = list ; elem != NULL ; elem = elem->next)
    1.22 +
    1.23  typedef struct UcxDlist UcxDlist;
    1.24  struct UcxDlist {
    1.25      void     *data;

mercurial