From: David van Moolenbroek Date: Mon, 20 Dec 2010 23:52:53 +0000 (+0000) Subject: sys/queue.h: add LIST_FOREACH_SAFE X-Git-Tag: v3.2.0~711 X-Git-Url: http://zhaoyanbai.com/repos/doc/man.3.txt?a=commitdiff_plain;h=d23c3d110e8190723d3afdae0fc86269b7ef4948;p=minix.git sys/queue.h: add LIST_FOREACH_SAFE --- diff --git a/include/sys/queue.h b/include/sys/queue.h index 4c72a39dd..91a83423b 100644 --- a/include/sys/queue.h +++ b/include/sys/queue.h @@ -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. */