diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-06 16:20:44 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-06 16:20:44 +0200 |
commit | 6c834f997d337a4d9c615e1d155963018a3cc3fa (patch) | |
tree | 365e6559aa4e19209b1accc2d0832476fda3bc05 /src/libmdsserver | |
parent | m (diff) | |
download | mds-6c834f997d337a4d9c615e1d155963018a3cc3fa.tar.gz mds-6c834f997d337a4d9c615e1d155963018a3cc3fa.tar.bz2 mds-6c834f997d337a4d9c615e1d155963018a3cc3fa.tar.xz |
add foreach_linked_list_node
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/linked-list.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libmdsserver/linked-list.h b/src/libmdsserver/linked-list.h index 69298ca..30808fc 100644 --- a/src/libmdsserver/linked-list.h +++ b/src/libmdsserver/linked-list.h @@ -266,6 +266,15 @@ void linked_list_marshal(const linked_list_t* restrict this, char* restrict data */ int linked_list_unmarshal(linked_list_t* restrict this, char* restrict data); +/** + * Wrapper for `for` keyword that iterates over each element in a linked list + * + * @param list:linked_list_t The linked list + * @param node:ssize_t The variable to store the node in at each iteration + */ +#define foreach_linked_list_node(list, node) \ + for (node = list.edge; (node = list.next[node]) != list.edge;) + #endif |