summaryrefslogtreecommitdiffstats
path: root/src/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/list.h')
-rw-r--r--src/list.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/list.h b/src/list.h
index 9f8fd20..5cb6264 100644
--- a/src/list.h
+++ b/src/list.h
@@ -188,6 +188,15 @@
LIST_VOID_(item->next = NULL)
/**
+ * Check if a singly-linked list is empty.
+ */
+#define SLIST_EMPTY(list) \
+ SLIST_EMPTY_((list))
+
+#define SLIST_EMPTY_(list) \
+ ((void)sizeof(list->tail - &list->head), !list->head)
+
+/**
* Insert an item into a singly-linked list.
*
* @param list
@@ -336,6 +345,15 @@ static inline void *slist_remove_impl(void *ret, void *cursor, void *next, void
LIST_VOID_(item->prev = item->next = NULL)
/**
+ * Check if a doubly-linked list is empty.
+ */
+#define LIST_EMPTY(list) \
+ LIST_EMPTY_((list))
+
+#define LIST_EMPTY_(list) \
+ ((void)sizeof(list->tail - list->head), !list->head)
+
+/**
* Add an item to the tail of a doubly-linked list.
*
* @param list