[PATCH] list_is_last utility

Add another list utility function to check for last element in a list.

Signed-off-by: Shailabh Nagar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Shailabh Nagar authored and Linus Torvalds committed 2006-07-14 21:53:56 -07:00
1 parent 22caf04297
commit e8f4d97e1b
1 file changed
+11
+11
View File
@@ -264,6 +264,17 @@ static inline void list_move_tail(struct list_head *list,
list_add_tail(list, head);
}
/**
* list_is_last - tests whether @list is the last entry in list @head
* @list: the entry to test
* @head: the head of the list
*/
static inline int list_is_last(const struct list_head *list,
const struct list_head *head)
{
return list->next == head;
}
/**
* list_empty - tests whether a list is empty
* @head: the list to test.