Added the safe version of the list_for_each function.

This commit is contained in:
Jaroslav Kysela 2001-02-13 12:53:19 +00:00
parent db53ac9b41
commit 6ea4260c1c
6 changed files with 35 additions and 28 deletions

View file

@ -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)
/**