mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Add list_iterate that's safe with deletions.
This commit is contained in:
parent
cd7018fd2c
commit
2f069a65d0
@ -47,7 +47,10 @@ static inline int list_empty(struct list *head) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define list_iterate(v, 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) {
|
static inline int list_size(struct list *head) {
|
||||||
int s = 0;
|
int s = 0;
|
||||||
|
@ -47,7 +47,10 @@ static inline int list_empty(struct list *head) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define list_iterate(v, 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) {
|
static inline int list_size(struct list *head) {
|
||||||
int s = 0;
|
int s = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user