X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Flist%2Flist.h;h=faad86f5c736a3a53ed08c79e74f92c39086a810;hb=c07a2b209d44273098e2d435ebdca82f158c0373;hp=0091ea4b655216754a347cb4ccb655aa8823177e;hpb=e59b7388d8b2b56dc759be7c2dbf63100d2e131f;p=ccan diff --git a/ccan/list/list.h b/ccan/list/list.h index 0091ea4b..faad86f5 100644 --- a/ccan/list/list.h +++ b/ccan/list/list.h @@ -1,4 +1,4 @@ -/* Licensed under LGPLv2.1+ - see LICENSE file for details */ +/* Licensed under BSD-MIT - see LICENSE file for details */ #ifndef CCAN_LIST_H #define CCAN_LIST_H #include @@ -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)))