]> Zhao Yanbai Git Server - minix.git/commitdiff
sys/queue.h: add LIST_FOREACH_SAFE
authorDavid van Moolenbroek <david@minix3.org>
Mon, 20 Dec 2010 23:52:53 +0000 (23:52 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Mon, 20 Dec 2010 23:52:53 +0000 (23:52 +0000)
include/sys/queue.h

index 4c72a39dd2ac0c0ff6095202cd8a5a7ff68ebd86..91a83423b529b5fd35e28dd922234e6ab2d538cb 100644 (file)
@@ -166,6 +166,11 @@ struct {                                                           \
                (var);                                                  \
                (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.
  */