diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2020-05-15 14:41:23 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2020-05-20 16:01:20 +0200 |
commit | deb51601818ec9d2f9a29205896125c82cf6ce00 (patch) | |
tree | e307912684f50ce5d434651bd4f03669790c14e8 /base | |
parent | 16da6651a1eebd776aa461db76cecaf3997cbf50 (diff) | |
download | lvm2-deb51601818ec9d2f9a29205896125c82cf6ce00.tar.gz |
list: use container_of
Reuse macro
Diffstat (limited to 'base')
-rw-r--r-- | base/data-struct/list.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/base/data-struct/list.h b/base/data-struct/list.h index 54cb1c10b..e0a6256a4 100644 --- a/base/data-struct/list.h +++ b/base/data-struct/list.h @@ -1,7 +1,7 @@ #ifndef BASE_DATA_STRUCT_LIST_H #define BASE_DATA_STRUCT_LIST_H -#include <stddef.h> /* offsetof */ +#include "base/memory/container_of.h" //---------------------------------------------------------------- @@ -100,7 +100,7 @@ struct dm_list *dm_list_next(const struct dm_list *head, const struct dm_list *e * contained in a structure of type t, return the containing structure. */ #define dm_list_struct_base(v, t, head) \ - ((t *)((const char *)(v) - offsetof(t, head))) + container_of(v, t, head) /* * Given the address v of an instance of 'struct dm_list list' contained in |