From c90681b8505946761b55d4981c9c3b56b3c4171b Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Wed, 5 Oct 2011 17:05:25 +0200 Subject: batman-adv: fixed hash functions type to uint32_t instead of int There are two reasons for this fix: - the result of choose_orig() and vis_choose() is an index and therefore it can't be negative. Hence it is correct to make the return type unsigned too. - sizeof(int) may not be the same on ALL the architectures. Since we plan to use choose_orig() as DHT hash function, we need to guarantee that, given the same argument, the result is the same. Then it is correct to explicitly express the size of the return type (and the second argument). Since the expected length is currently 4, uint32_t is the most convenient choice. Signed-off-by: Antonio Quartulli Signed-off-by: Sven Eckelmann --- net/batman-adv/hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/batman-adv/hash.c') diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c index 2a172505f51..d1da29da333 100644 --- a/net/batman-adv/hash.c +++ b/net/batman-adv/hash.c @@ -25,7 +25,7 @@ /* clears the hash */ static void hash_init(struct hashtable_t *hash) { - int i; + uint32_t i; for (i = 0 ; i < hash->size; i++) { INIT_HLIST_HEAD(&hash->table[i]); @@ -42,7 +42,7 @@ void hash_destroy(struct hashtable_t *hash) } /* allocates and clears the hash */ -struct hashtable_t *hash_new(int size) +struct hashtable_t *hash_new(uint32_t size) { struct hashtable_t *hash; -- cgit v1.2.3