X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Flist%2Flist.h;h=faad86f5c736a3a53ed08c79e74f92c39086a810;hp=4a18f02d9c90e6465781582f54996afd402f6ee6;hb=f98c408ee4e2f655e009e2499a02aeb2cc2fa905;hpb=3b4e940a92de5de1adbc1d4945112105c0e68860 diff --git a/ccan/list/list.h b/ccan/list/list.h index 4a18f02d..faad86f5 100644 --- a/ccan/list/list.h +++ b/ccan/list/list.h @@ -279,6 +279,8 @@ static inline void list_del_from(struct list_head *h, struct list_node *n) * Example: * struct child *first; * first = list_top(&parent->children, struct child, list); + * if (!first) + * printf("Empty list!\n"); */ #define list_top(h, type, member) \ ((type *)list_top_((h), list_off_(type, member))) @@ -301,6 +303,8 @@ static inline const void *list_top_(const struct list_head *h, size_t off) * Example: * struct child *last; * last = list_tail(&parent->children, struct child, list); + * if (!last) + * printf("Empty list!\n"); */ #define list_tail(h, type, member) \ ((type *)list_tail_((h), list_off_(type, member)))