ucx/dlist.h

changeset 121
311cac04d079
parent 120
8170f658f017
equal deleted inserted replaced
120:8170f658f017 121:311cac04d079
34 34
35 #ifdef __cplusplus 35 #ifdef __cplusplus
36 extern "C" { 36 extern "C" {
37 #endif 37 #endif
38 38
39 /**
40 * Loop statement for UCX lists.
41 *
42 * The first argument is a pointer to the list. In most cases this will be the
43 * pointer to the first element of the list, but it may also be an arbitrary
44 * element of the list. The iteration will then start with that element.
45 *
46 * The second argument is the name of the iteration variable. The scope of
47 * this variable is limited to the <code>UCX_FOREACH</code> statement.
48 *
49 * @param list The first element of the list
50 * @param elem The variable name of the element
51 */
52 #define UCX_FOREACH(list,elem) \
53 for (UcxDlist* elem = list ; elem != NULL ; elem = elem->next)
54
39 typedef struct UcxDlist UcxDlist; 55 typedef struct UcxDlist UcxDlist;
40 struct UcxDlist { 56 struct UcxDlist {
41 void *data; 57 void *data;
42 UcxDlist *next; 58 UcxDlist *next;
43 UcxDlist *prev; 59 UcxDlist *prev;

mercurial