aboutsummaryrefslogtreecommitdiff
path: root/sys-queue.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-09-01 02:12:32 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-09-09 14:55:16 -0500
commitbb150dc82f089c33e688694baa34a03377fcfda8 (patch)
treead80c5e76d3df65631ecb36fb9ca0a10457cdc25 /sys-queue.h
parent8718e999b3fcb33ebcc83a58c5538379fbb17e83 (diff)
Add LIST_FOREACH_SAFE() definition
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'sys-queue.h')
-rw-r--r--sys-queue.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys-queue.h b/sys-queue.h
index cb6a4c8906..eb89a4d217 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.
*/