summaryrefslogtreecommitdiffstats
path: root/src/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/list.h')
-rw-r--r--src/list.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/list.h b/src/list.h
index 89f00ed..a284c25 100644
--- a/src/list.h
+++ b/src/list.h
@@ -280,11 +280,13 @@ static inline void *slist_remove_impl(void *ret, void *cursor, void *next, void
* The list to pop from.
* @param node (optional)
* If specified, use head->node.next rather than head->next.
+ * @return
+ * The popped item, or NULL if the list was empty.
*/
#define SLIST_POP(...) SLIST_POP_(__VA_ARGS__, )
#define SLIST_POP_(list, ...) \
- SLIST_REMOVE_(list, &(list)->head, __VA_ARGS__)
+ ((list)->head ? SLIST_REMOVE_(list, &(list)->head, __VA_ARGS__) : NULL)
/**
* Initialize a doubly-linked list.