Skip to content

Commit

Permalink
[PATCH] list_is_last utility
Browse files Browse the repository at this point in the history
Add another list utility function to check for last element in a list.

Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Shailabh Nagar authored and Linus Torvalds committed Jul 15, 2006
1 parent 22caf04 commit e8f4d97
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/linux/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e8f4d97

Please sign in to comment.