From 7bf5d99223b40e71629ec164d9a397538378a3bd Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sun, 15 May 2016 13:33:15 -0400 Subject: [PATCH] lib: Fix some more compiler warnings Three different changes: a) in nexthop.c we have an actual bug, we've rearranged the enumerated types and the list of enums has changed, we were displaying the wrong nexthop information. b) Remove some dead code from sockunion.h c) '\0' evaluates to 0 which is NULL. vector_set takes a pointer. Signed-off-by: Donald Sharp Reviewed-by: Daniel Walton --- lib/nexthop.c | 5 ----- lib/sockunion.h | 17 ----------------- lib/vty.c | 6 +++--- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/lib/nexthop.c b/lib/nexthop.c index 2a8d343a8c..5853884218 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -82,16 +82,11 @@ nexthop_type_to_str (enum nexthop_types_t nh_type) "Interface route", "IPv4 nexthop", "IPv4 nexthop with ifindex", - "IPv4 nexthop with ifname", "IPv6 nexthop", "IPv6 nexthop with ifindex", - "IPv6 nexthop with ifname", "Null0 nexthop", }; - if (nh_type >= ZEBRA_NUM_OF (desc)) - return ""; - return desc[nh_type]; } diff --git a/lib/sockunion.h b/lib/sockunion.h index 195c2fff92..f041f95a10 100644 --- a/lib/sockunion.h +++ b/lib/sockunion.h @@ -25,28 +25,11 @@ #include "privs.h" -#if 0 -union sockunion { - struct sockinet { - u_char si_len; - u_char si_family; - u_short si_port; - } su_si; - struct sockaddr_in su_sin; - struct sockaddr_in6 su_sin6; -}; -#define su_len su_si.si_len -#define su_family su_si.si_family -#define su_port su_si.si_port -#endif /* 0 */ - union sockunion { struct sockaddr sa; struct sockaddr_in sin; -#ifdef HAVE_IPV6 struct sockaddr_in6 sin6; -#endif /* HAVE_IPV6 */ }; enum connect_result diff --git a/lib/vty.c b/lib/vty.c index 13b8b3019f..105d559279 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -870,7 +870,7 @@ vty_complete_command (struct vty *vty) /* In case of 'help \t'. */ if (isspace ((int) vty->buf[vty->length - 1])) - vector_set (vline, '\0'); + vector_set (vline, NULL); matched = cmd_complete_command (vline, vty, &ret); @@ -985,11 +985,11 @@ vty_describe_command (struct vty *vty) if (vline == NULL) { vline = vector_init (1); - vector_set (vline, '\0'); + vector_set (vline, NULL); } else if (isspace ((int) vty->buf[vty->length - 1])) - vector_set (vline, '\0'); + vector_set (vline, NULL); describe = cmd_describe_command (vline, vty, &ret); -- 2.39.5