diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2019-08-08 01:00:58 +0200 |
---|---|---|
committer | Olivier Dugeon <olivier.dugeon@orange.com> | 2020-04-30 11:27:20 +0200 |
commit | 0b7005375f37efe712820b283bc8677fc93ab57b (patch) | |
tree | cdbd35d4b9c947ea1cc6e9ae71d050531242f126 /lib/if.c | |
parent | Merge pull request #6241 from volta-networks/fix_ldp_acl (diff) | |
download | frr-0b7005375f37efe712820b283bc8677fc93ab57b.tar.xz frr-0b7005375f37efe712820b283bc8677fc93ab57b.zip |
lib: constify a few parameters of helper functions
Parameters should be const whenever possible to improve code
readability and remove the need to cast away the constness of
const arguments.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/if.c')
-rw-r--r-- | lib/if.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -410,7 +410,7 @@ struct interface *if_lookup_by_index_all_vrf(ifindex_t ifindex) } /* Lookup interface by IP address. */ -struct interface *if_lookup_exact_address(void *src, int family, +struct interface *if_lookup_exact_address(const void *src, int family, vrf_id_t vrf_id) { struct vrf *vrf = vrf_lookup_by_id(vrf_id); @@ -442,7 +442,7 @@ struct interface *if_lookup_exact_address(void *src, int family, } /* Lookup interface by IP address. */ -struct connected *if_lookup_address(void *matchaddr, int family, +struct connected *if_lookup_address(const void *matchaddr, int family, vrf_id_t vrf_id) { struct vrf *vrf = vrf_lookup_by_id(vrf_id); @@ -479,7 +479,7 @@ struct connected *if_lookup_address(void *matchaddr, int family, } /* Lookup interface by prefix */ -struct interface *if_lookup_prefix(struct prefix *prefix, vrf_id_t vrf_id) +struct interface *if_lookup_prefix(const struct prefix *prefix, vrf_id_t vrf_id) { struct vrf *vrf = vrf_lookup_by_id(vrf_id); struct listnode *cnode; @@ -982,7 +982,8 @@ nbr_connected_log(struct nbr_connected *connected, char *str) } /* If two connected address has same prefix return 1. */ -static int connected_same_prefix(struct prefix *p1, struct prefix *p2) +static int connected_same_prefix(const struct prefix *p1, + const struct prefix *p2) { if (p1->family == p2->family) { if (p1->family == AF_INET @@ -1010,7 +1011,7 @@ unsigned int connected_count_by_family(struct interface *ifp, int family) } struct connected *connected_lookup_prefix_exact(struct interface *ifp, - struct prefix *p) + const struct prefix *p) { struct listnode *node; struct listnode *next; @@ -1049,7 +1050,7 @@ struct connected *connected_delete_by_prefix(struct interface *ifp, /* Find the address on our side that will be used when packets are sent to dst. */ struct connected *connected_lookup_prefix(struct interface *ifp, - struct prefix *addr) + const struct prefix *addr) { struct listnode *cnode; struct connected *c; |