From 63c4b3df3e502e4d6e24c43504867de9968a47a3 Mon Sep 17 00:00:00 2001 From: Madeorsk Date: Sat, 11 Feb 2023 19:23:26 +0100 Subject: [PATCH] Improve krsforeach definition to accept arguments without parentheses. --- include/ksr/arrays.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ksr/arrays.h b/include/ksr/arrays.h index a8c69cd..7ee2396 100644 --- a/include/ksr/arrays.h +++ b/include/ksr/arrays.h @@ -87,6 +87,6 @@ static inline void ksrarray_free(ksrarray *array) */ #define ksrarray_foreach(ksrarray, element) \ for(size_t _ksrarray_get_iter_name(ksrarray, element) = 0; \ - (element = ksrarray.data[_ksrarray_get_iter_name(ksrarray, element)]) || true, \ - _ksrarray_get_iter_name(ksrarray, element) < ksrarray.length; \ + (element = (ksrarray).data[_ksrarray_get_iter_name(ksrarray, element)]) || true, \ + _ksrarray_get_iter_name(ksrarray, element) < (ksrarray).length; \ _ksrarray_get_iter_name(ksrarray, element)++)