From: Adrian Vovk Date: Wed, 4 Sep 2024 03:45:08 +0000 (-0400) Subject: strv: Fixup STRV_FOREACH_PAIR macro X-Git-Tag: v257-rc1~415^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e671bdc5c34a0d522edb40b3c35a7904bcdea26e;p=thirdparty%2Fsystemd.git 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 --- 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)