Updating foreach macros with the new iterators API
This commit is contained in:
1 parent
7c82fff41d
commit
e4a7b01d3a
1 file changed
+6
-6
+6
-6
@@ -20,12 +20,12 @@
|
||||
#ifndef CMC_FOREACH_H
|
||||
#define CMC_FOREACH_H
|
||||
|
||||
#define CMC_FOREACH(PFX, SNAME, ITERNAME, TARGET) \
|
||||
for (struct SNAME##_iter ITERNAME = (TARGET)->it_start(TARGET); \
|
||||
!PFX##_iter_end(&ITERNAME); PFX##_iter_next(&ITERNAME))
|
||||
#define CMC_FOREACH(PFX, SNAME, ITERNAME, TARGET) \
|
||||
for (struct SNAME##_iter ITERNAME = PFX##_iter_start(TARGET); \
|
||||
!PFX##_iter_at_end(&ITERNAME); PFX##_iter_next(&ITERNAME))
|
||||
|
||||
#define CMC_FOREACH_REV(PFX, SNAME, ITERNAME, TARGET) \
|
||||
for (struct SNAME##_iter ITERNAME = (TARGET)->it_end(TARGET); \
|
||||
!PFX##_iter_start(&ITERNAME); PFX##_iter_prev(&ITERNAME))
|
||||
#define CMC_FOREACH_REV(PFX, SNAME, ITERNAME, TARGET) \
|
||||
for (struct SNAME##_iter ITERNAME = PFX##_iter_end(TARGET); \
|
||||
!PFX##_iter_at_start(&ITERNAME); PFX##_iter_prev(&ITERNAME))
|
||||
|
||||
#endif /* CMC_FOREACH_H */
|
||||
Reference in new issue
Block a user