diff options
author | Alasdair Kergon <agk@redhat.com> | 2005-10-16 23:03:59 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2005-10-16 23:03:59 +0000 |
commit | 2262b32057a7a60b3de3876b26b192fa4d05205c (patch) | |
tree | e2593b67101f9e681cf3a9a5dafedb58c23c661a /libdm/datastruct | |
parent | a3f6b2ce798cf738c4e8bf510f86ebd45815842c (diff) | |
download | lvm2-2262b32057a7a60b3de3876b26b192fa4d05205c.tar.gz |
Use hash, bitset, malloc, pool from libdevmapper.
Diffstat (limited to 'libdm/datastruct')
-rw-r--r-- | libdm/datastruct/list.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h index e2fbc76c1..d996a8bd4 100644 --- a/libdm/datastruct/list.h +++ b/libdm/datastruct/list.h @@ -203,6 +203,26 @@ static inline struct list *list_next(struct list *head, struct list *elem) #define list_iterate_items(v, head) list_iterate_items_gen(v, (head), list) /* + * Walk a list, setting 'v' in turn to the containing structure of each item. + * The containing structure should be the same type as 'v'. + * The 'struct list' variable within the containing structure is 'field'. + * t must be defined as a temporary variable of the same type as v. + */ +#define list_iterate_items_gen_safe(v, t, head, field) \ + for (v = list_struct_base((head)->n, typeof(*v), field), \ + t = list_struct_base(v->field.n, typeof(*v), field); \ + &v->field != (head); \ + v = t, t = list_struct_base(v->field.n, typeof(*v), field)) +/* + * Walk a list, setting 'v' in turn to the containing structure of each item. + * The containing structure should be the same type as 'v'. + * The list should be 'struct list list' within the containing structure. + * t must be defined as a temporary variable of the same type as v. + */ +#define list_iterate_items_safe(v, t, head) \ + list_iterate_items_gen_safe(v, t, (head), list) + +/* * Walk a list backwards, setting 'v' in turn to the containing structure * of each item. * The containing structure should be the same type as 'v'. |