list: Adopt list_next_entry() from the Linux kernel
We'll use it to traverse the list of opaque btf_encoder entries in pahole. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
6edae3e768
commit
e9b83dba79
8
list.h
8
list.h
|
@ -289,6 +289,14 @@ static inline void list_splice_init(struct list_head *list,
|
||||||
#define list_first_entry(ptr, type, member) \
|
#define list_first_entry(ptr, type, member) \
|
||||||
list_entry((ptr)->next, type, member)
|
list_entry((ptr)->next, type, member)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_next_entry - get the next element in list
|
||||||
|
* @pos: the type * to cursor
|
||||||
|
* @member: the name of the list_head within the struct.
|
||||||
|
*/
|
||||||
|
#define list_next_entry(pos, member) \
|
||||||
|
list_entry((pos)->member.next, typeof(*(pos)), member)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* list_for_each - iterate over a list
|
* list_for_each - iterate over a list
|
||||||
* @pos: the &struct list_head to use as a loop cursor.
|
* @pos: the &struct list_head to use as a loop cursor.
|
||||||
|
|
Loading…
Reference in New Issue