Use bool instead of bool:1 if your compiler doesn't create correct code
[m6w6/libmemcached] / libhashkit / fnv.c
index fd171ceff3a407dfdab3c88a0ef8b42c5db4932a..ee3754d84371a0590e18328189d0d10b078375d3 100644 (file)
@@ -14,13 +14,12 @@ static uint64_t FNV_64_PRIME= UINT64_C(0x100000001b3);
 static uint32_t FNV_32_INIT= 2166136261UL;
 static uint32_t FNV_32_PRIME= 16777619;
 
-uint32_t hashkit_fnv1_64(const char *key, size_t key_length)
+uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context __attribute__((unused)))
 {
   /* Thanks to pierre@demartines.com for the pointer */
   uint64_t hash= FNV_64_INIT;
-  size_t x= 0;
 
-  for (x= 0; x < key_length; x++)
+  for (size_t x= 0; x < key_length; x++)
   {
     hash *= FNV_64_PRIME;
     hash ^= (uint64_t)key[x];
@@ -29,12 +28,11 @@ uint32_t hashkit_fnv1_64(const char *key, size_t key_length)
   return (uint32_t)hash;
 }
 
-uint32_t hashkit_fnv1a_64(const char *key, size_t key_length)
+uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context __attribute__((unused)))
 {
   uint32_t hash= (uint32_t) FNV_64_INIT;
-  size_t x= 0;
 
-  for (x= 0; x < key_length; x++)
+  for (size_t x= 0; x < key_length; x++)
   {
     uint32_t val= (uint32_t)key[x];
     hash ^= val;
@@ -44,12 +42,11 @@ uint32_t hashkit_fnv1a_64(const char *key, size_t key_length)
   return hash;
 }
 
-uint32_t hashkit_fnv1_32(const char *key, size_t key_length)
+uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context __attribute__((unused)))
 {
   uint32_t hash= FNV_32_INIT;
-  size_t x= 0;
 
-  for (x= 0; x < key_length; x++)
+  for (size_t x= 0; x < key_length; x++)
   {
     uint32_t val= (uint32_t)key[x];
     hash *= FNV_32_PRIME;
@@ -59,12 +56,11 @@ uint32_t hashkit_fnv1_32(const char *key, size_t key_length)
   return hash;
 }
 
-uint32_t hashkit_fnv1a_32(const char *key, size_t key_length)
+uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context __attribute__((unused)))
 {
   uint32_t hash= FNV_32_INIT;
-  size_t x= 0;
 
-  for (x= 0; x < key_length; x++)
+  for (size_t x= 0; x < key_length; x++)
   {
     uint32_t val= (uint32_t)key[x];
     hash ^= val;