From e6a7fc11a4d939870c9b2cee11ceb061a6737a21 Mon Sep 17 00:00:00 2001 From: Alex Burmashev Date: Tue, 16 Feb 2021 07:07:14 -0500 Subject: [PATCH] add list_empty to linked list primitives Signed-off-by: Alex Burmashev --- include/list.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/list.h b/include/list.h index b98a889..ad87b45 100644 --- a/include/list.h +++ b/include/list.h @@ -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)