sys/queue.h: add LIST_FOREACH_SAFE

This commit is contained in:
David van Moolenbroek 2010-12-20 23:52:53 +00:00
parent 361f377493
commit d23c3d110e

View file

@ -166,6 +166,11 @@ struct { \
(var); \ (var); \
(var) = ((var)->field.le_next)) (var) = ((var)->field.le_next))
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))
/* /*
* List access methods. * List access methods.
*/ */