-#define LIST_FOR_EACH(ITER, STRUCT, MEMBER, LIST) \
- for (ITER = CONTAINER_OF((LIST)->next, STRUCT, MEMBER); \
- &(ITER)->MEMBER != (LIST); \
- ITER = CONTAINER_OF((ITER)->MEMBER.next, STRUCT, MEMBER))
-#define LIST_FOR_EACH_REVERSE(ITER, STRUCT, MEMBER, LIST) \
- for (ITER = CONTAINER_OF((LIST)->prev, STRUCT, MEMBER); \
- &(ITER)->MEMBER != (LIST); \
- ITER = CONTAINER_OF((ITER)->MEMBER.prev, STRUCT, MEMBER))
-#define LIST_FOR_EACH_SAFE(ITER, NEXT, STRUCT, MEMBER, LIST) \
- for (ITER = CONTAINER_OF((LIST)->next, STRUCT, MEMBER); \
- (NEXT = CONTAINER_OF((ITER)->MEMBER.next, STRUCT, MEMBER), \
- &(ITER)->MEMBER != (LIST)); \
- ITER = NEXT)
+#define LIST_FOR_EACH(ITER, MEMBER, LIST) \
+ for (ASSIGN_CONTAINER(ITER, (LIST)->next, MEMBER); \
+ &(ITER)->MEMBER != (LIST); \
+ ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER))
+#define LIST_FOR_EACH_CONTINUE(ITER, MEMBER, LIST) \
+ for (ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER); \
+ &(ITER)->MEMBER != (LIST); \
+ ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER))
+#define LIST_FOR_EACH_REVERSE(ITER, MEMBER, LIST) \
+ for (ASSIGN_CONTAINER(ITER, (LIST)->prev, MEMBER); \
+ &(ITER)->MEMBER != (LIST); \
+ ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.prev, MEMBER))
+#define LIST_FOR_EACH_REVERSE_CONTINUE(ITER, MEMBER, LIST) \
+ for (ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.prev, MEMBER); \
+ &(ITER)->MEMBER != (LIST); \
+ ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.prev, MEMBER))
+#define LIST_FOR_EACH_SAFE(ITER, NEXT, MEMBER, LIST) \
+ for (ASSIGN_CONTAINER(ITER, (LIST)->next, MEMBER); \
+ (&(ITER)->MEMBER != (LIST) \
+ ? ASSIGN_CONTAINER(NEXT, (ITER)->MEMBER.next, MEMBER), 1 \
+ : 0); \
+ (ITER) = (NEXT))