summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shared/macro.h9
-rw-r--r--src/test/test-util.c1
2 files changed, 5 insertions, 5 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 08a036b3b9..d53b07fea5 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -324,13 +324,14 @@ do { \
#define SET_FLAG(v, flag, b) \
(v) = (b) ? ((v) | (flag)) : ((v) & ~(flag))
-#define IN_SET(x, ...) \
+#define IN_SET(x, y, ...) \
({ \
- const typeof(x) _x = (x); \
+ const typeof(y) _y = (y); \
+ const typeof(_y) _x = (x); \
unsigned _i; \
bool _found = false; \
- for (_i = 0; _i < sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
- if (((const typeof(_x)[]) { __VA_ARGS__ })[_i] == _x) { \
+ 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) { \
_found = true; \
break; \
} \
diff --git a/src/test/test-util.c b/src/test/test-util.c
index 1de06dbda8..229f492889 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -574,7 +574,6 @@ static void test_fstab_node_to_udev_node(void) {
assert_se(streq(n, "/dev/disk/by-partuuid/037b9d94-148e-4ee4-8d38-67bfe15bb535"));
free(n);
-
n = fstab_node_to_udev_node("PONIES=awesome");
puts(n);
assert_se(streq(n, "PONIES=awesome"));