diff options
author | Karel Zak <kzak@redhat.com> | 2012-12-18 14:49:21 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2012-12-18 15:00:03 +0100 |
commit | 59da1544ce82813e88c24ed8b612ba39ea1e3cc2 (patch) | |
tree | 242757c82633f737a21f64d403557dab32af9bef /include | |
parent | 35e52fa531ed5d6e3bc45438b3ef294449e31c8b (diff) | |
download | util-linux-59da1544ce82813e88c24ed8b612ba39ea1e3cc2.tar.gz |
include/list: add list_last_entry()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/list.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/list.h b/include/list.h index 414d356b..e9ed0c4c 100644 --- a/include/list.h +++ b/include/list.h @@ -127,11 +127,11 @@ _INLINE_ int list_empty(struct list_head *head) } /** - * list_last_entry - tests whether is entry last in the list + * list_entry_is_last - tests whether is entry last in the list * @entry: the entry to test. * @head: the list to test. */ -_INLINE_ int list_last_entry(struct list_head *entry, struct list_head *head) +_INLINE_ int list_entry_is_last(struct list_head *entry, struct list_head *head) { return head->prev == entry; } @@ -171,6 +171,9 @@ _INLINE_ void list_splice(struct list_head *list, struct list_head *head) #define list_first_entry(head, type, member) \ ((head) && (head)->next != (head) ? list_entry((head)->next, type, member) : NULL) +#define list_last_entry(head, type, member) \ + ((head) && (head)->prev != (head) ? list_entry((head)->prev, type, member) : NULL) + /** * list_for_each - iterate over elements in a list * @pos: the &struct list_head to use as a loop counter. |