bgpd isisd ldpd lib: const drop fixes (SA)

Can be detected with e.g. ./configure CFLAGS=-Wcast-qual CC=clang

Signed-off-by: F. Aragon <paco@voltanet.io>
This commit is contained in:
F. Aragon 2018-09-17 18:22:59 +02:00
parent 6efca3442f
commit 36de6e0e1e
No known key found for this signature in database
GPG Key ID: FD112A8C7E6A5E4A
11 changed files with 27 additions and 27 deletions

View File

@ -260,11 +260,11 @@ void bgp_attr_flush_encap(struct attr *attr)
*
* This algorithm could be made faster if needed
*/
static int encap_same(struct bgp_attr_encap_subtlv *h1,
struct bgp_attr_encap_subtlv *h2)
static int encap_same(const struct bgp_attr_encap_subtlv *h1,
const struct bgp_attr_encap_subtlv *h2)
{
struct bgp_attr_encap_subtlv *p;
struct bgp_attr_encap_subtlv *q;
const struct bgp_attr_encap_subtlv *p;
const struct bgp_attr_encap_subtlv *q;
if (h1 == h2)
return 1;
@ -357,8 +357,8 @@ static unsigned int encap_hash_key_make(void *p)
static int encap_hash_cmp(const void *p1, const void *p2)
{
return encap_same((struct bgp_attr_encap_subtlv *)p1,
(struct bgp_attr_encap_subtlv *)p2);
return encap_same((const struct bgp_attr_encap_subtlv *)p1,
(const struct bgp_attr_encap_subtlv *)p2);
}
static void encap_init(void)

View File

@ -519,7 +519,7 @@ DEFUN (bgp_fs_local_install_ifname,
{
struct bgp *bgp = VTY_GET_CONTEXT(bgp);
int idx = 0;
const char *no = strmatch(argv[0]->text, (char *)"no") ? "no" : NULL;
const char *no = strmatch(argv[0]->text, "no") ? "no" : NULL;
char *ifname = argv_find(argv, argc, "INTERFACE", &idx) ?
argv[idx]->arg : NULL;

View File

@ -171,8 +171,7 @@ static void isis_redist_update_ext_reach(struct isis_area *area, int level,
if (redist->map_name) {
map_ret =
route_map_apply(redist->map, (struct prefix *)p,
RMAP_ISIS, &area_info);
route_map_apply(redist->map, p, RMAP_ISIS, &area_info);
if (map_ret == RMAP_DENYMATCH)
area_info.distance = 255;
}
@ -441,7 +440,8 @@ static void isis_redist_set(struct isis_area *area, int level, int family,
}
isis_redist_update_ext_reach(area, level, redist, p,
(struct prefix_ipv6 *)src_p, info);
(const struct prefix_ipv6 *)src_p,
info);
}
}

View File

@ -106,8 +106,8 @@ static int isis_vertex_queue_hash_cmp(const void *a, const void *b)
if (prefix_cmp(&va->N.ip.dest, &vb->N.ip.dest))
return 0;
return prefix_cmp((struct prefix *)&va->N.ip.src,
(struct prefix *)&vb->N.ip.src) == 0;
return prefix_cmp((const struct prefix *)&va->N.ip.src,
(const struct prefix *)&vb->N.ip.src) == 0;
}
return memcmp(va->N.id, vb->N.id, ISIS_SYS_ID_LEN + 1) == 0;

View File

@ -60,11 +60,11 @@ adj_compare(const struct adj *a, const struct adj *b)
switch (a->source.type) {
case HELLO_LINK:
if (if_cmp_name_func((char *)a->source.link.ia->iface->name,
(char *)b->source.link.ia->iface->name) < 0)
if (if_cmp_name_func(a->source.link.ia->iface->name,
b->source.link.ia->iface->name) < 0)
return (-1);
if (if_cmp_name_func((char *)a->source.link.ia->iface->name,
(char *)b->source.link.ia->iface->name) > 0)
if (if_cmp_name_func(a->source.link.ia->iface->name,
b->source.link.ia->iface->name) > 0)
return (1);
return (ldp_addrcmp(a->source.link.ia->af,
&a->source.link.src_addr, &b->source.link.src_addr));

View File

@ -45,7 +45,7 @@ RB_GENERATE(iface_head, iface, entry, iface_compare)
static __inline int
iface_compare(const struct iface *a, const struct iface *b)
{
return (if_cmp_name_func((char *)a->name, (char *)b->name));
return if_cmp_name_func(a->name, b->name);
}
struct iface *

View File

@ -119,7 +119,7 @@ l2vpn_exit(struct l2vpn *l2vpn)
static __inline int
l2vpn_if_compare(const struct l2vpn_if *a, const struct l2vpn_if *b)
{
return (if_cmp_name_func((char *)a->ifname, (char *)b->ifname));
return if_cmp_name_func(a->ifname, b->ifname);
}
struct l2vpn_if *
@ -182,7 +182,7 @@ l2vpn_if_update(struct l2vpn_if *lif)
static __inline int
l2vpn_pw_compare(const struct l2vpn_pw *a, const struct l2vpn_pw *b)
{
return (if_cmp_name_func((char *)a->ifname, (char *)b->ifname));
return if_cmp_name_func(a->ifname, b->ifname);
}
struct l2vpn_pw *

View File

@ -618,8 +618,8 @@ static int cmd_try_do_shortcut(enum node_type node, char *first_word)
*/
static int compare_completions(const void *fst, const void *snd)
{
struct cmd_token *first = *(struct cmd_token **)fst,
*secnd = *(struct cmd_token **)snd;
const struct cmd_token *first = *(const struct cmd_token * const *)fst,
*secnd = *(const struct cmd_token * const *)snd;
return strcmp(first->text, secnd->text);
}

View File

@ -63,7 +63,7 @@ int ptm_enable = 0;
* before all numbers. Examples: de0 < de1, de100 < fxp0 < xl0, devpty <
* devpty0, de0 < del0
*/
int if_cmp_name_func(char *p1, char *p2)
int if_cmp_name_func(const char *p1, const char *p2)
{
unsigned int l1, l2;
long int x1, x2;
@ -99,8 +99,8 @@ int if_cmp_name_func(char *p1, char *p2)
if (!*p2)
return 1;
x1 = strtol(p1, &p1, 10);
x2 = strtol(p2, &p2, 10);
x1 = strtol(p1, (char **)&p1, 10);
x2 = strtol(p2, (char **)&p2, 10);
/* let's compare numbers now */
if (x1 < x2)
@ -121,7 +121,7 @@ int if_cmp_name_func(char *p1, char *p2)
static int if_cmp_func(const struct interface *ifp1,
const struct interface *ifp2)
{
return if_cmp_name_func((char *)ifp1->name, (char *)ifp2->name);
return if_cmp_name_func(ifp1->name, ifp2->name);
}
static int if_cmp_index_func(const struct interface *ifp1,

View File

@ -455,7 +455,7 @@ struct nbr_connected {
#endif /* IFF_VIRTUAL */
/* Prototypes. */
extern int if_cmp_name_func(char *, char *);
extern int if_cmp_name_func(const char *p1, const char *p2);
/*
* Passing in VRF_UNKNOWN is a valid thing to do, unless we

View File

@ -301,5 +301,5 @@ const char *srcdest_rnode2str(struct route_node *rn, char *str, int size)
const struct prefix *dst_p, *src_p;
srcdest_rnode_prefixes(rn, &dst_p, &src_p);
return srcdest2str(dst_p, (struct prefix_ipv6*)src_p, str, size);
return srcdest2str(dst_p, (const struct prefix_ipv6 *)src_p, str, size);
}