From e671bdc5c34a0d522edb40b3c35a7904bcdea26e Mon Sep 17 00:00:00 2001 From: Adrian Vovk Date: Tue, 3 Sep 2024 23:45:08 -0400 Subject: [PATCH] strv: Fixup STRV_FOREACH_PAIR macro The macro didn't properly parenthesize a caller-controlled argument. For example: `STRV_FOREACH_PAIR(a, b, something ?: something_else)` would expand to `typeof(*something ?: something_else)`, which would cause compile failures --- src/basic/strv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/strv.h b/src/basic/strv.h index bd90305e63e..d38d5bf5384 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -153,7 +153,7 @@ bool strv_overlap(char * const *a, char * const *b) _pure_; _STRV_FOREACH_BACKWARDS(s, l, UNIQ_T(h, UNIQ), UNIQ_T(i, UNIQ)) #define _STRV_FOREACH_PAIR(x, y, l, i) \ - for (typeof(*l) *x, *y, *i = (l); \ + for (typeof(*(l)) *x, *y, *i = (l); \ i && *(x = i) && *(y = i + 1); \ i += 2) -- 2.47.3