summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-05-14 22:19:07 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-05-14 23:23:08 +0200
commitd8b87afe7c5fcee9caaef7124d5bcd5f0c3af8a1 (patch)
treeca07ea6097ec12120806ff4c7bd268b9fc063842 /bfdd
parentMerge pull request #4335 from opensourcerouting/zebra-fpm-blackhole-info (diff)
downloadfrr-d8b87afe7c5fcee9caaef7124d5bcd5f0c3af8a1.tar.xz
frr-d8b87afe7c5fcee9caaef7124d5bcd5f0c3af8a1.zip
lib: hashing functions should take const arguments
It doesn't make much sense for a hash function to modify its argument, so const the hash input. BGP does it in a couple places, those cast away the const. Not great but not any worse than it was. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index a2e84e928..57d8ffa6d 100644
--- a/bfdd/bfd.c
+++ b/bfdd/bfd.c
@@ -1271,16 +1271,16 @@ void bs_to_bpc(struct bfd_session *bs, struct bfd_peer_cfg *bpc)
static struct hash *bfd_id_hash;
static struct hash *bfd_key_hash;
-static unsigned int bfd_id_hash_do(void *p);
-static unsigned int bfd_key_hash_do(void *p);
+static unsigned int bfd_id_hash_do(const void *p);
+static unsigned int bfd_key_hash_do(const void *p);
static void _bfd_free(struct hash_bucket *hb,
void *arg __attribute__((__unused__)));
/* BFD hash for our discriminator. */
-static unsigned int bfd_id_hash_do(void *p)
+static unsigned int bfd_id_hash_do(const void *p)
{
- struct bfd_session *bs = p;
+ const struct bfd_session *bs = p;
return jhash_1word(bs->discrs.my_discr, 0);
}
@@ -1293,9 +1293,9 @@ static bool bfd_id_hash_cmp(const void *n1, const void *n2)
}
/* BFD hash for single hop. */
-static unsigned int bfd_key_hash_do(void *p)
+static unsigned int bfd_key_hash_do(const void *p)
{
- struct bfd_session *bs = p;
+ const struct bfd_session *bs = p;
return jhash(&bs->key, sizeof(bs->key), 0);
}