summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-02-03 13:30:41 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-02-03 13:30:41 -0400
commit70ac364620612da17de42d3ac040fd61716e8f1d (patch)
tree4928dcdd07ab342ea3247d5d71782ce6243f53d0 /include
parentfa6928e23fb6dcff6ba9e409ac82c76e777dfdaa (diff)
pso/macros: Add `FOREACH_NODE{,_NODECL}_MULTI_ITER`
This allows for iterating multiple things within a `FOREACH_NODE` macro.
Diffstat (limited to 'include')
-rw-r--r--include/pso/macros.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/pso/macros.h b/include/pso/macros.h
index f7498c3..1a75d53 100644
--- a/include/pso/macros.h
+++ b/include/pso/macros.h
@@ -2,7 +2,11 @@
#define MACROS_H
#define OBJECT_NAME(name) static const char *name##_name = #name;
+
#define FOREACH_NODE(type, first, varname) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->next))
#define FOREACH_NODE_NODECL(type, first, varname) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->next))
+#define FOREACH_NODE_MULTI_ITER(type, first, varname, ...) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->next), __VA_ARGS__)
+#define FOREACH_NODE_NODECL_MULTI_ITER(type, first, varname, ...) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->next), __VA_ARGS__)
+
#endif