Improve krsforeach definition to accept arguments without parentheses.

This commit is contained in:
Madeorsk 2023-02-11 19:23:26 +01:00
parent b2577c710e
commit 63c4b3df3e

View File

@ -87,6 +87,6 @@ static inline void ksrarray_free(ksrarray *array)
*/ */
#define ksrarray_foreach(ksrarray, element) \ #define ksrarray_foreach(ksrarray, element) \
for(size_t _ksrarray_get_iter_name(ksrarray, element) = 0; \ for(size_t _ksrarray_get_iter_name(ksrarray, element) = 0; \
(element = ksrarray.data[_ksrarray_get_iter_name(ksrarray, element)]) || true, \ (element = (ksrarray).data[_ksrarray_get_iter_name(ksrarray, element)]) || true, \
_ksrarray_get_iter_name(ksrarray, element) < ksrarray.length; \ _ksrarray_get_iter_name(ksrarray, element) < (ksrarray).length; \
_ksrarray_get_iter_name(ksrarray, element)++) _ksrarray_get_iter_name(ksrarray, element)++)