]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/set.h
tree-wide: define iterator inside of the macro
[thirdparty/systemd.git] / src / basic / set.h
index 42cc064ac47162dd6583b9035395f39f4eb6365e..7170eea84c1437cc042c8b6fa6407381415e2489 100644 (file)
@@ -135,8 +135,10 @@ int _set_put_strdupv(Set **s, char **l  HASHMAP_DEBUG_PARAMS);
 
 int set_put_strsplit(Set *s, const char *v, const char *separators, ExtractFlags flags);
 
-#define SET_FOREACH(e, s, i) \
-        for ((i) = ITERATOR_FIRST; set_iterate((s), &(i), (void**)&(e)); )
+#define _SET_FOREACH(e, s, i) \
+        for (Iterator i = ITERATOR_FIRST; set_iterate((s), &i, (void**)&(e)); )
+#define SET_FOREACH(e, s) \
+        _SET_FOREACH(e, s, UNIQ_T(i, UNIQ))
 
 #define SET_FOREACH_MOVE(e, d, s)                                       \
         for (; ({ e = set_first(s); assert_se(!e || set_move_one(d, s, e) >= 0); e; }); )