mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Added the safe version of the list_for_each function.
This commit is contained in:
parent
db53ac9b41
commit
6ea4260c1c
6 changed files with 35 additions and 28 deletions
|
|
@ -139,10 +139,18 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea
|
|||
/**
|
||||
* list_for_each - iterate over a list
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
* @head: the head for your list.
|
||||
*/
|
||||
#define list_for_each(pos, head) \
|
||||
for (pos = (head)->next ; pos != (head); pos = pos->next)
|
||||
|
||||
/**
|
||||
* list_for_each_safe - iterate over a list safely (actual pointer can be invalidated)
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
* @next: the &struct list_head to use to save next.
|
||||
* @head: the head for your list.
|
||||
*/
|
||||
#define list_for_each(pos, npos, head) \
|
||||
#define list_for_each_safe(pos, npos, head) \
|
||||
for (pos = (head)->next, npos = pos->next ; pos != (head); pos = npos, npos = pos->next)
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue