batman-adv: use the const qualifier in hash functions
authorAntonio Quartulli <antonio@open-mesh.com>
Fri, 7 Dec 2012 13:35:36 +0000 (14:35 +0100)
committerAntonio Quartulli <ordex@autistici.org>
Sat, 12 Jan 2013 10:58:22 +0000 (20:58 +1000)
The data argument in each hash function should carry the
"const" qualifier as it is never modified.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/hash.h

index 724adf053dcc0f2b43429488a46e133e5c55136b..5e834c1df46913610c3f52015eb527910137a71c 100644 (file)
@@ -57,7 +57,7 @@ static inline uint32_t batadv_choose_claim(const void *data, uint32_t size)
 static inline uint32_t batadv_choose_backbone_gw(const void *data,
                                                 uint32_t size)
 {
-       struct batadv_claim *claim = (struct batadv_claim *)data;
+       const struct batadv_claim *claim = (struct batadv_claim *)data;
        uint32_t hash = 0;
 
        hash = batadv_hash_bytes(hash, &claim->addr, sizeof(claim->addr));
index e05333905afd566117bf1267d6e3ac05596c89c1..ea02148243272f546fb3439ace9a490b70c84651 100644 (file)
@@ -89,7 +89,7 @@ static inline void batadv_hash_delete(struct batadv_hashtable *hash,
  *
  *     Returns the new hash value.
  */
-static inline uint32_t batadv_hash_bytes(uint32_t hash, void *data,
+static inline uint32_t batadv_hash_bytes(uint32_t hash, const void *data,
                                         uint32_t size)
 {
        const unsigned char *key = data;