From f98c408ee4e2f655e009e2499a02aeb2cc2fa905 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 31 Oct 2012 21:53:17 +1030 Subject: [PATCH 1/1] list: fix unused var warning. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit /home/rusty/devel/cvs/ccan/ccan/list/list.h: In function ‘main’: /home/rusty/devel/cvs/ccan/ccan/list/list.h:280:15: warning: variable ‘first’ set but not used [-Wunused-but-set-variable] /home/rusty/devel/cvs/ccan/ccan/list/list.h: In function ‘main’: /home/rusty/devel/cvs/ccan/ccan/list/list.h:304:15: warning: variable ‘last’ set but not used [-Wunused-but-set-variable] Signed-off-by: Rusty Russell --- ccan/list/list.h | 4 ++++ 1 file changed, 4 insertions(+) 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))) -- 2.39.2