From 24d879de227c348cc21880f047287f79accb44d1 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 30 Jan 2023 14:33:31 -0400 Subject: TObject, macros: Add `FOREACH_NODE` macros for dealing with TObject iteration Thanks to EpochFlame for suggesting this. --- include/pso/macros.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/pso/macros.h') diff --git a/include/pso/macros.h b/include/pso/macros.h index c449b6f..f7498c3 100644 --- a/include/pso/macros.h +++ b/include/pso/macros.h @@ -2,5 +2,7 @@ #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)) #endif -- cgit v1.2.3-13-gbd6f