From: Juan Quintela Date: Tue, 1 Sep 2009 00:12:32 +0000 (+0200) Subject: Add LIST_FOREACH_SAFE() definition X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~10693 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb150dc82f089c33e688694baa34a03377fcfda8;p=sdk%2Femulator%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 cb6a4c8..eb89a4d 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. */