aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/linked-list.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libmdsserver/linked-list.h9
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