add list_empty to linked list primitives

Signed-off-by: Alex Burmashev <alexander.burmashev@oracle.com>
This commit is contained in:
Alex Burmashev 2021-02-16 07:07:14 -05:00 committed by Peter Jones
parent 0287b5a864
commit e6a7fc11a4

View File

@ -32,6 +32,12 @@ typedef struct list_head list_t;
(ptr)->prev = (ptr); \
})
static inline int
list_empty(const struct list_head *head)
{
return head->next == head;
}
static inline void
__list_add(struct list_head *new, struct list_head *prev,
struct list_head *next)