From: Juan Quintela Date: Tue, 1 Sep 2009 00:12:32 +0000 (+0200) Subject: Add LIST_FOREACH_SAFE() definition X-Git-Tag: v0.12.0-rc0~1261 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb150dc82f089c33e688694baa34a03377fcfda8;p=thirdparty%2Fqemu.git Add LIST_FOREACH_SAFE() definition Signed-off-by: Juan Quintela Signed-off-by: Anthony Liguori --- diff --git a/sys-queue.h b/sys-queue.h index cb6a4c89063..eb89a4d217c 100644 --- a/sys-queue.h +++ b/sys-queue.h @@ -126,6 +126,11 @@ struct { \ (var); \ (var) = ((var)->field.le_next)) +#define LIST_FOREACH_SAFE(var, head, field, next_var) \ + for ((var) = ((head)->lh_first); \ + (var) && ((next_var) = ((var)->field.le_next), 1); \ + (var) = (next_var)) + /* * List access methods. */