Skip to content

Commit

Permalink
add list.h
Browse files Browse the repository at this point in the history
  • Loading branch information
pengdeyue committed Aug 10, 2016
1 parent d6cc166 commit f499e75
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions list.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// 多了一个临时变量,用来存储当前节点。
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list. */
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)#define list_for_each(pos, head) \
for (pos = (head)->next; prefetch(pos->next), pos != (head); \
pos = pos->next)

0 comments on commit f499e75

Please sign in to comment.