diff options
author | Antonio Quartulli <ordex@autistici.org> | 2011-10-05 19:05:25 +0400 |
---|---|---|
committer | Sven Eckelmann <sven@narfation.org> | 2011-11-20 16:08:33 +0400 |
commit | c90681b8505946761b55d4981c9c3b56b3c4171b (patch) | |
tree | b260388317b5dc1f4a8c00493eea6ff30fb47652 /net/batman-adv/hash.c | |
parent | eb7e2a1e20488f91c7007caa080b83b8e4222572 (diff) | |
download | linux-c90681b8505946761b55d4981c9c3b56b3c4171b.tar.xz |
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 <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/hash.c')
-rw-r--r-- | net/batman-adv/hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c index 2a172505f513..d1da29da333b 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; |