1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add list_iterate that's safe with deletions.

This commit is contained in:
Alasdair Kergon 2002-01-29 16:28:52 +00:00
parent cd7018fd2c
commit 2f069a65d0
2 changed files with 8 additions and 2 deletions

View File

@ -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;

View File

@ -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;