]> Zhao Yanbai Git Server - minix.git/commitdiff
sys/queue.h: add LIST_FOREACH_SAFE to netbsd copy
authorDavid van Moolenbroek <david@minix3.org>
Fri, 23 Dec 2011 18:05:09 +0000 (19:05 +0100)
committerDavid van Moolenbroek <david@minix3.org>
Fri, 23 Dec 2011 18:05:09 +0000 (19:05 +0100)
nbsd_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.
  */