From d23c3d110e8190723d3afdae0fc86269b7ef4948 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Mon, 20 Dec 2010 23:52:53 +0000 Subject: [PATCH] sys/queue.h: add LIST_FOREACH_SAFE --- include/sys/queue.h | 5 +++++ 1 file changed, 5 insertions(+) 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. */ -- 2.44.0