diff --git a/src/util/list.h b/src/util/list.h index 17800e4ed4e9f479653ccd1e9f60489d813108db..d50eb1ea5dde481711d1f726d47323d8544b4d3a 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -241,6 +241,13 @@ static inline void list_validate(const struct list_head *list) &pos->member != (head); \ pos = LIST_ENTRY(type, pos->member.next, member)) +#define list_for_each_entry_from_safe(type, pos, start, head, member) \ + for (type *pos = LIST_ENTRY(type, (start), member), \ + *__next = LIST_ENTRY(type, pos->member.next, member); \ + &pos->member != (head); \ + pos = __next, \ + __next = LIST_ENTRY(type, __next->member.next, member)) + #define list_for_each_entry_from_rev(type, pos, start, head, member) \ for (type *pos = LIST_ENTRY(type, (start), member); \ &pos->member != (head); \