diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-08-14 16:25:25 +0100 |
---|---|---|
committer | Paul Jakma <paul@quagga.net> | 2008-08-22 19:52:58 +0100 |
commit | ffe11cfb0a808ae514193438616dfabc512b4cf6 (patch) | |
tree | 94452dba2c1a49d6e6a0782c6513acb36823cefc /bgpd/bgp_aspath.c | |
parent | 9fd4958a4eef88c536e4a5aeefce302e10ee8ee6 (diff) |
[lib] hash compare function arguments ought to be const qualified
2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com>
* lib/hash.h: (struct hash) Hash comparator callback really
ought to treat storage behind arguments as constant - a compare
function with side-effects would be evil.
* */*.c: Adjust comparator functions similarly, thus fixing at least
a few compiler warnings about const qualifier being dropped.
Signed-off-by: Paul Jakma <paul@quagga.net>
Diffstat (limited to 'bgpd/bgp_aspath.c')
-rw-r--r-- | bgpd/bgp_aspath.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 38c9caa6..006fc917 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -1347,10 +1347,10 @@ aspath_add_seq (struct aspath *aspath, as_t asno) /* Compare leftmost AS value for MED check. If as1's leftmost AS and as2's leftmost AS is same return 1. */ int -aspath_cmp_left (struct aspath *aspath1, struct aspath *aspath2) +aspath_cmp_left (const struct aspath *aspath1, const struct aspath *aspath2) { - struct assegment *seg1 = NULL; - struct assegment *seg2 = NULL; + const struct assegment *seg1 = NULL; + const struct assegment *seg2 = NULL; if (!(aspath1 && aspath2)) return 0; @@ -1484,7 +1484,7 @@ aspath_reconcile_as4 ( struct aspath *aspath, struct aspath *as4path) as2's leftmost AS is same return 1. (confederation as-path only). */ int -aspath_cmp_left_confed (struct aspath *aspath1, struct aspath *aspath2) +aspath_cmp_left_confed (const struct aspath *aspath1, const struct aspath *aspath2) { if (! (aspath1 && aspath2) ) return 0; @@ -1769,10 +1769,10 @@ aspath_key_make (void *p) /* If two aspath have same value then return 1 else return 0 */ static int -aspath_cmp (void *arg1, void *arg2) +aspath_cmp (const void *arg1, const void *arg2) { - struct assegment *seg1 = ((struct aspath *)arg1)->segments; - struct assegment *seg2 = ((struct aspath *)arg2)->segments; + const struct assegment *seg1 = ((struct aspath *)arg1)->segments; + const struct assegment *seg2 = ((struct aspath *)arg2)->segments; while (seg1 || seg2) { |