diff options
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r-- | bgpd/bgp_attr.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 752099d1..6f139742 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -131,15 +131,13 @@ cluster_hash_key_make (void *p) } static int -cluster_hash_cmp (void *p1, void *p2) +cluster_hash_cmp (const void *p1, const void *p2) { - struct cluster_list * cluster1 = (struct cluster_list *) p1; - struct cluster_list * cluster2 = (struct cluster_list *) p2; + const struct cluster_list * cluster1 = p1; + const struct cluster_list * cluster2 = p2; - if (cluster1->length == cluster2->length && - memcmp (cluster1->list, cluster2->list, cluster1->length) == 0) - return 1; - return 0; + return (cluster1->length == cluster2->length && + memcmp (cluster1->list, cluster2->list, cluster1->length) == 0); } static void @@ -267,15 +265,13 @@ transit_hash_key_make (void *p) } static int -transit_hash_cmp (void *p1, void *p2) +transit_hash_cmp (const void *p1, const void *p2) { - struct transit * transit1 = (struct transit *) p1; - struct transit * transit2 = (struct transit *) p2; + const struct transit * transit1 = p1; + const struct transit * transit2 = p2; - if (transit1->length == transit2->length && - memcmp (transit1->val, transit2->val, transit1->length) == 0) - return 1; - return 0; + return (transit1->length == transit2->length && + memcmp (transit1->val, transit2->val, transit1->length) == 0); } static void @@ -393,10 +389,10 @@ attrhash_key_make (void *p) } int -attrhash_cmp (void *p1, void *p2) +attrhash_cmp (const void *p1, const void *p2) { - struct attr * attr1 = (struct attr *) p1; - struct attr * attr2 = (struct attr *) p2; + const struct attr * attr1 = p1; + const struct attr * attr2 = p2; if (attr1->flag == attr2->flag && attr1->origin == attr2->origin @@ -408,8 +404,8 @@ attrhash_cmp (void *p1, void *p2) && attr1->pathlimit.ttl == attr2->pathlimit.ttl && attr1->pathlimit.as == attr2->pathlimit.as) { - struct attr_extra *ae1 = attr1->extra; - struct attr_extra *ae2 = attr2->extra; + const struct attr_extra *ae1 = attr1->extra; + const struct attr_extra *ae2 = attr2->extra; if (ae1 && ae2 && ae1->aggregator_as == ae2->aggregator_as @@ -435,7 +431,7 @@ attrhash_cmp (void *p1, void *p2) } static void -attrhash_init () +attrhash_init (void) { attrhash = hash_create (attrhash_key_make, attrhash_cmp); } |