Skip to content

Commit

Permalink
list: Adopt list_next_entry() from the Linux kernel
Browse files Browse the repository at this point in the history
We'll use it to traverse the list of opaque btf_encoder entries in
pahole.

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Aug 20, 2021
1 parent 6edae3e commit e9b83db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions list.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ static inline void list_splice_init(struct list_head *list,
#define list_first_entry(ptr, 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
* @pos: the &struct list_head to use as a loop cursor.
Expand Down

0 comments on commit e9b83db

Please sign in to comment.