diff options
author | Alasdair Kergon <agk@redhat.com> | 2002-01-29 16:28:52 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2002-01-29 16:28:52 +0000 |
commit | 2f069a65d0f789bd71305ef5aac3a954204c4f09 (patch) | |
tree | b293fea0f2e793e9f3c337b2baa2d3700ee5b77d /libdm/datastruct | |
parent | cd7018fd2cae9f79f80cd95f2c46bf4628d0e661 (diff) | |
download | lvm2-2f069a65d0f789bd71305ef5aac3a954204c4f09.tar.gz lvm2-2f069a65d0f789bd71305ef5aac3a954204c4f09.tar.xz lvm2-2f069a65d0f789bd71305ef5aac3a954204c4f09.zip |
Add list_iterate that's safe with deletions.
Diffstat (limited to 'libdm/datastruct')
-rw-r--r-- | libdm/datastruct/list.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h index cfda137a..5f2e14c1 100644 --- a/libdm/datastruct/list.h +++ b/libdm/datastruct/list.h @@ -47,7 +47,10 @@ static inline int list_empty(struct list *head) { } #define list_iterate(v, head) \ - for (v = (head)->n; v != head; v = v->n) + for (v = (head)->n; v != head; v = v->n) + +#define list_iterate_safe(v, t, head) \ + for (v = (head)->n, t = v->n; v != head; v = t, t = v->n) static inline int list_size(struct list *head) { int s = 0; |