summaryrefslogtreecommitdiffstats
path: root/libdm/datastruct
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2005-04-06 15:21:28 +0000
committerAlasdair Kergon <agk@redhat.com>2005-04-06 15:21:28 +0000
commit06cc0dade215c604c9adb6809d177f677a8e8461 (patch)
tree93d62916345ed5bf152c9298c29887e241eb7e43 /libdm/datastruct
parent1128f56b1e88c887eca1361d69ed6621cf9191b7 (diff)
downloadlvm2-06cc0dade215c604c9adb6809d177f677a8e8461.tar.gz
lvm2-06cc0dade215c604c9adb6809d177f677a8e8461.tar.xz
lvm2-06cc0dade215c604c9adb6809d177f677a8e8461.zip
more refinements
Diffstat (limited to 'libdm/datastruct')
-rw-r--r--libdm/datastruct/list.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h
index 4c36a6bc..0510e91b 100644
--- a/libdm/datastruct/list.h
+++ b/libdm/datastruct/list.h
@@ -120,11 +120,11 @@ static inline struct list *list_next(struct list *head, struct list *elem)
}
/*
- * Given the address v of an instance of 'struct list h' contained in
- * a structure of type t, return the containing structure.
+ * Given the address v of an instance of 'struct list' called 'head'
+ * contained in a structure of type t, return the containing structure.
*/
-#define list_struct_base(v, t, h) \
- ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->h))
+#define list_struct_base(v, t, head) \
+ ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->head))
/*
* Given the address v of an instance of 'struct list list' contained in
@@ -172,18 +172,19 @@ static inline struct list *list_next(struct list *head, struct list *elem)
/*
* 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 'l'.
+ * The 'struct list' variable within the containing structure is 'field'.
*/
-#define list_iterate_items_head(v, head, l) \
- for (v = list_struct_base((head)->n, typeof(*v), l); &v->l != (head); \
- v = list_struct_base(v->l.n, typeof(*v), l))
+#define list_iterate_items_gen(v, head, field) \
+ for (v = list_struct_base((head)->n, typeof(*v), field); \
+ &v->field != (head); \
+ v = 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.
*/
-#define list_iterate_items(v, head) list_iterate_items_head(v, (head), list)
+#define list_iterate_items(v, head) list_iterate_items_gen(v, (head), list)
/*
* Return the number of elements in a list by walking it.