X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Fmacro.h;h=627d768b76bada29f5f7d106a13ca215a55470cf;hp=58530a398089a1ff16b199111bde046659a3bf40;hb=21ecddbbb2c9e06d080b2526a870898a8b90f52a;hpb=1cfc78c91965df340cdde100ad6cb3ed50b28927;ds=sidebyside diff --git a/src/basic/macro.h b/src/basic/macro.h index 58530a398..627d768b7 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -407,12 +407,12 @@ do { \ #define IN_SET(x, y, ...) \ ({ \ - const typeof(y) _y = (y); \ - const typeof(_y) _x = (x); \ + static const typeof(y) _array[] = { (y), __VA_ARGS__ }; \ + const typeof(y) _x = (x); \ unsigned _i; \ bool _found = false; \ - for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \ - if (((const typeof(_x)[]) { _y, __VA_ARGS__ })[_i] == _x) { \ + for (_i = 0; _i < ELEMENTSOF(_array); _i++) \ + if (_array[_i] == _x) { \ _found = true; \ break; \ } \