fix set never used warnings

(This patch was modified to leave calls to stream_getl() in place, they
are necessary for the stream's internal pointer to advance to the
correct position. -- Denis)

Signed-off-by: Denis Ovsienko <infrastation@yandex.ru>

Fix gcc warnings about varables that are set but never used.

* bgpd/bgp_attr.c
  * cluster_unintern(): ret
  * transit_unintern(): ret
  * bgp_attr_default_intern(): attre
  * bgp_mp_reach_parse(): rd_high, rd_low
* bgpd/bgp_route.c
  * bgp_announce_check_rsclient(): bgp
* bgpd/bgp_zebra.c
  * zebra_read_ipv4(): ifindex
  * zebra_read_ipv6(): ifindex
* bgpd/bgpd.c
  * bgp_config_write_peer(): filter
* lib/distribute.c
  * distribute_list_all(): dist
  * distribute_list(): dist
  * distribute_list_prefix_all(): dist
  * distribute_list_prefix(): dist
* lib/if_rmap.c
  * if_rmap(): if_rmap
* lib/vty.c
  * vty_accept(): vty
* lib/zclient.c
  * zclient_read(): ret
* zebra/irdp_interface.c
  * if_group(): zi
* zebra/rt_netlink.c
  * kernel_read(): ret, sock
This commit is contained in:
Stephen Hemminger 2011-12-18 19:43:40 +04:00 committed by Denis Ovsienko
parent b48cebbba0
commit 9206f9ecd5
10 changed files with 26 additions and 58 deletions

View File

@ -175,14 +175,12 @@ cluster_intern (struct cluster_list *cluster)
void void
cluster_unintern (struct cluster_list *cluster) cluster_unintern (struct cluster_list *cluster)
{ {
struct cluster_list *ret;
if (cluster->refcnt) if (cluster->refcnt)
cluster->refcnt--; cluster->refcnt--;
if (cluster->refcnt == 0) if (cluster->refcnt == 0)
{ {
ret = hash_release (cluster_hash, cluster); hash_release (cluster_hash, cluster);
cluster_free (cluster); cluster_free (cluster);
} }
} }
@ -235,14 +233,12 @@ transit_intern (struct transit *transit)
void void
transit_unintern (struct transit *transit) transit_unintern (struct transit *transit)
{ {
struct transit *ret;
if (transit->refcnt) if (transit->refcnt)
transit->refcnt--; transit->refcnt--;
if (transit->refcnt == 0) if (transit->refcnt == 0)
{ {
ret = hash_release (transit_hash, transit); hash_release (transit_hash, transit);
transit_free (transit); transit_free (transit);
} }
} }
@ -552,10 +548,9 @@ bgp_attr_default_intern (u_char origin)
{ {
struct attr attr; struct attr attr;
struct attr *new; struct attr *new;
struct attr_extra *attre;
memset (&attr, 0, sizeof (struct attr)); memset (&attr, 0, sizeof (struct attr));
attre = bgp_attr_extra_get (&attr); bgp_attr_extra_get (&attr);
bgp_attr_default_set(&attr, origin); bgp_attr_default_set(&attr, origin);
@ -1516,14 +1511,9 @@ bgp_mp_reach_parse (struct peer *peer, const bgp_size_t length,
memcpy(&attr->nexthop.s_addr, &attre->mp_nexthop_global_in, 4); memcpy(&attr->nexthop.s_addr, &attre->mp_nexthop_global_in, 4);
break; break;
case 12: case 12:
{ stream_getl (s); /* RD high */
u_int32_t rd_high; stream_getl (s); /* RD low */
u_int32_t rd_low; stream_get (&attre->mp_nexthop_global_in, s, 4);
rd_high = stream_getl (s);
rd_low = stream_getl (s);
stream_get (&attre->mp_nexthop_global_in, s, 4);
}
break; break;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
case 16: case 16:

View File

@ -1069,11 +1069,9 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient,
struct bgp_filter *filter; struct bgp_filter *filter;
struct bgp_info info; struct bgp_info info;
struct peer *from; struct peer *from;
struct bgp *bgp;
from = ri->peer; from = ri->peer;
filter = &rsclient->filter[afi][safi]; filter = &rsclient->filter[afi][safi];
bgp = rsclient->bgp;
if (DISABLE_BGP_ANNOUNCE) if (DISABLE_BGP_ANNOUNCE)
return 0; return 0;

View File

@ -232,12 +232,10 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)
{ {
struct stream *s; struct stream *s;
struct zapi_ipv4 api; struct zapi_ipv4 api;
unsigned long ifindex;
struct in_addr nexthop; struct in_addr nexthop;
struct prefix_ipv4 p; struct prefix_ipv4 p;
s = zclient->ibuf; s = zclient->ibuf;
ifindex = 0;
nexthop.s_addr = 0; nexthop.s_addr = 0;
/* Type, flags, message. */ /* Type, flags, message. */
@ -260,7 +258,7 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_IFINDEX)) if (CHECK_FLAG (api.message, ZAPI_MESSAGE_IFINDEX))
{ {
api.ifindex_num = stream_getc (s); api.ifindex_num = stream_getc (s);
ifindex = stream_getl (s); stream_getl (s); /* ifindex, unused */
} }
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE)) if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE))
api.distance = stream_getc (s); api.distance = stream_getc (s);
@ -310,12 +308,10 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length)
{ {
struct stream *s; struct stream *s;
struct zapi_ipv6 api; struct zapi_ipv6 api;
unsigned long ifindex;
struct in6_addr nexthop; struct in6_addr nexthop;
struct prefix_ipv6 p; struct prefix_ipv6 p;
s = zclient->ibuf; s = zclient->ibuf;
ifindex = 0;
memset (&nexthop, 0, sizeof (struct in6_addr)); memset (&nexthop, 0, sizeof (struct in6_addr));
/* Type, flags, message. */ /* Type, flags, message. */
@ -338,7 +334,7 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length)
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_IFINDEX)) if (CHECK_FLAG (api.message, ZAPI_MESSAGE_IFINDEX))
{ {
api.ifindex_num = stream_getc (s); api.ifindex_num = stream_getc (s);
ifindex = stream_getl (s); stream_getl (s); /* ifindex, unused */
} }
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE)) if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE))
api.distance = stream_getc (s); api.distance = stream_getc (s);

View File

@ -4721,12 +4721,10 @@ static void
bgp_config_write_peer (struct vty *vty, struct bgp *bgp, bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
struct peer *peer, afi_t afi, safi_t safi) struct peer *peer, afi_t afi, safi_t safi)
{ {
struct bgp_filter *filter;
struct peer *g_peer = NULL; struct peer *g_peer = NULL;
char buf[SU_ADDRSTRLEN]; char buf[SU_ADDRSTRLEN];
char *addr; char *addr;
filter = &peer->filter[afi][safi];
addr = peer->host; addr = peer->host;
if (peer_group_active (peer)) if (peer_group_active (peer))
g_peer = peer->group->conf; g_peer = peer->group->conf;

View File

@ -299,7 +299,6 @@ DEFUN (distribute_list_all,
"Filter outgoing routing updates\n") "Filter outgoing routing updates\n")
{ {
enum distribute_type type; enum distribute_type type;
struct distribute *dist;
/* Check of distribute list type. */ /* Check of distribute list type. */
if (strncmp (argv[1], "i", 1) == 0) if (strncmp (argv[1], "i", 1) == 0)
@ -314,7 +313,7 @@ DEFUN (distribute_list_all,
} }
/* Get interface name corresponding distribute list. */ /* Get interface name corresponding distribute list. */
dist = distribute_list_set (NULL, type, argv[0]); distribute_list_set (NULL, type, argv[0]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -379,7 +378,6 @@ DEFUN (distribute_list,
"Interface name\n") "Interface name\n")
{ {
enum distribute_type type; enum distribute_type type;
struct distribute *dist;
/* Check of distribute list type. */ /* Check of distribute list type. */
if (strncmp (argv[1], "i", 1) == 0) if (strncmp (argv[1], "i", 1) == 0)
@ -393,7 +391,7 @@ DEFUN (distribute_list,
} }
/* Get interface name corresponding distribute list. */ /* Get interface name corresponding distribute list. */
dist = distribute_list_set (argv[2], type, argv[0]); distribute_list_set (argv[2], type, argv[0]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -458,7 +456,6 @@ DEFUN (distribute_list_prefix_all,
"Filter outgoing routing updates\n") "Filter outgoing routing updates\n")
{ {
enum distribute_type type; enum distribute_type type;
struct distribute *dist;
/* Check of distribute list type. */ /* Check of distribute list type. */
if (strncmp (argv[1], "i", 1) == 0) if (strncmp (argv[1], "i", 1) == 0)
@ -473,7 +470,7 @@ DEFUN (distribute_list_prefix_all,
} }
/* Get interface name corresponding distribute list. */ /* Get interface name corresponding distribute list. */
dist = distribute_list_prefix_set (NULL, type, argv[0]); distribute_list_prefix_set (NULL, type, argv[0]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -541,7 +538,6 @@ DEFUN (distribute_list_prefix, distribute_list_prefix_cmd,
"Interface name\n") "Interface name\n")
{ {
enum distribute_type type; enum distribute_type type;
struct distribute *dist;
/* Check of distribute list type. */ /* Check of distribute list type. */
if (strncmp (argv[1], "i", 1) == 0) if (strncmp (argv[1], "i", 1) == 0)
@ -556,7 +552,7 @@ DEFUN (distribute_list_prefix, distribute_list_prefix_cmd,
} }
/* Get interface name corresponding distribute list. */ /* Get interface name corresponding distribute list. */
dist = distribute_list_prefix_set (argv[2], type, argv[0]); distribute_list_prefix_set (argv[2], type, argv[0]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -207,7 +207,6 @@ DEFUN (if_rmap,
"Route map interface name\n") "Route map interface name\n")
{ {
enum if_rmap_type type; enum if_rmap_type type;
struct if_rmap *if_rmap;
if (strncmp (argv[1], "i", 1) == 0) if (strncmp (argv[1], "i", 1) == 0)
type = IF_RMAP_IN; type = IF_RMAP_IN;
@ -219,7 +218,7 @@ DEFUN (if_rmap,
return CMD_WARNING; return CMD_WARNING;
} }
if_rmap = if_rmap_set (argv[2], type, argv[0]); if_rmap_set (argv[2], type, argv[0]);
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -1685,7 +1685,6 @@ static int
vty_accept (struct thread *thread) vty_accept (struct thread *thread)
{ {
int vty_sock; int vty_sock;
struct vty *vty;
union sockunion su; union sockunion su;
int ret; int ret;
unsigned int on; unsigned int on;
@ -1770,7 +1769,7 @@ vty_accept (struct thread *thread)
if (bufp) if (bufp)
XFREE (MTYPE_TMP, bufp); XFREE (MTYPE_TMP, bufp);
vty = vty_create (vty_sock, &su); vty_create (vty_sock, &su);
return 0; return 0;
} }

View File

@ -816,7 +816,6 @@ zebra_interface_address_read (int type, struct stream *s)
static int static int
zclient_read (struct thread *thread) zclient_read (struct thread *thread)
{ {
int ret;
size_t already; size_t already;
uint16_t length, command; uint16_t length, command;
uint8_t marker, version; uint8_t marker, version;
@ -911,47 +910,47 @@ zclient_read (struct thread *thread)
{ {
case ZEBRA_ROUTER_ID_UPDATE: case ZEBRA_ROUTER_ID_UPDATE:
if (zclient->router_id_update) if (zclient->router_id_update)
ret = (*zclient->router_id_update) (command, zclient, length); (*zclient->router_id_update) (command, zclient, length);
break; break;
case ZEBRA_INTERFACE_ADD: case ZEBRA_INTERFACE_ADD:
if (zclient->interface_add) if (zclient->interface_add)
ret = (*zclient->interface_add) (command, zclient, length); (*zclient->interface_add) (command, zclient, length);
break; break;
case ZEBRA_INTERFACE_DELETE: case ZEBRA_INTERFACE_DELETE:
if (zclient->interface_delete) if (zclient->interface_delete)
ret = (*zclient->interface_delete) (command, zclient, length); (*zclient->interface_delete) (command, zclient, length);
break; break;
case ZEBRA_INTERFACE_ADDRESS_ADD: case ZEBRA_INTERFACE_ADDRESS_ADD:
if (zclient->interface_address_add) if (zclient->interface_address_add)
ret = (*zclient->interface_address_add) (command, zclient, length); (*zclient->interface_address_add) (command, zclient, length);
break; break;
case ZEBRA_INTERFACE_ADDRESS_DELETE: case ZEBRA_INTERFACE_ADDRESS_DELETE:
if (zclient->interface_address_delete) if (zclient->interface_address_delete)
ret = (*zclient->interface_address_delete) (command, zclient, length); (*zclient->interface_address_delete) (command, zclient, length);
break; break;
case ZEBRA_INTERFACE_UP: case ZEBRA_INTERFACE_UP:
if (zclient->interface_up) if (zclient->interface_up)
ret = (*zclient->interface_up) (command, zclient, length); (*zclient->interface_up) (command, zclient, length);
break; break;
case ZEBRA_INTERFACE_DOWN: case ZEBRA_INTERFACE_DOWN:
if (zclient->interface_down) if (zclient->interface_down)
ret = (*zclient->interface_down) (command, zclient, length); (*zclient->interface_down) (command, zclient, length);
break; break;
case ZEBRA_IPV4_ROUTE_ADD: case ZEBRA_IPV4_ROUTE_ADD:
if (zclient->ipv4_route_add) if (zclient->ipv4_route_add)
ret = (*zclient->ipv4_route_add) (command, zclient, length); (*zclient->ipv4_route_add) (command, zclient, length);
break; break;
case ZEBRA_IPV4_ROUTE_DELETE: case ZEBRA_IPV4_ROUTE_DELETE:
if (zclient->ipv4_route_delete) if (zclient->ipv4_route_delete)
ret = (*zclient->ipv4_route_delete) (command, zclient, length); (*zclient->ipv4_route_delete) (command, zclient, length);
break; break;
case ZEBRA_IPV6_ROUTE_ADD: case ZEBRA_IPV6_ROUTE_ADD:
if (zclient->ipv6_route_add) if (zclient->ipv6_route_add)
ret = (*zclient->ipv6_route_add) (command, zclient, length); (*zclient->ipv6_route_add) (command, zclient, length);
break; break;
case ZEBRA_IPV6_ROUTE_DELETE: case ZEBRA_IPV6_ROUTE_DELETE:
if (zclient->ipv6_route_delete) if (zclient->ipv6_route_delete)
ret = (*zclient->ipv6_route_delete) (command, zclient, length); (*zclient->ipv6_route_delete) (command, zclient, length);
break; break;
default: default:
break; break;

View File

@ -99,14 +99,11 @@ if_group (struct interface *ifp,
u_int32_t group, u_int32_t group,
int add_leave) int add_leave)
{ {
struct zebra_if *zi;
struct ip_mreq m; struct ip_mreq m;
struct prefix *p; struct prefix *p;
int ret; int ret;
char b1[INET_ADDRSTRLEN]; char b1[INET_ADDRSTRLEN];
zi = ifp->info;
memset (&m, 0, sizeof (m)); memset (&m, 0, sizeof (m));
m.imr_multiaddr.s_addr = htonl (group); m.imr_multiaddr.s_addr = htonl (group);
p = irdp_get_prefix(ifp); p = irdp_get_prefix(ifp);

View File

@ -1827,11 +1827,7 @@ extern struct thread_master *master;
static int static int
kernel_read (struct thread *thread) kernel_read (struct thread *thread)
{ {
int ret; netlink_parse_info (netlink_information_fetch, &netlink);
int sock;
sock = THREAD_FD (thread);
ret = netlink_parse_info (netlink_information_fetch, &netlink);
thread_add_read (zebrad.master, kernel_read, NULL, netlink.sock); thread_add_read (zebrad.master, kernel_read, NULL, netlink.sock);
return 0; return 0;