[lib] hash compare function arguments ought to be const qualified
2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com>
* lib/hash.h: (struct hash) Hash comparator callback really
ought to treat storage behind arguments as constant - a compare
function with side-effects would be evil.
* */*.c: Adjust comparator functions similarly, thus fixing at least
a few compiler warnings about const qualifier being dropped.
Signed-off-by: Paul Jakma <paul@quagga.net>
diff --git a/lib/hash.c b/lib/hash.c
index 76bf802..3884051 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -27,7 +27,7 @@
/* Allocate a new hash. */
struct hash *
hash_create_size (unsigned int size, unsigned int (*hash_key) (void *),
- int (*hash_cmp) (void *, void *))
+ int (*hash_cmp) (const void *, const void *))
{
struct hash *hash;
@@ -46,7 +46,7 @@
/* Allocate a new hash with default hash size. */
struct hash *
hash_create (unsigned int (*hash_key) (void *),
- int (*hash_cmp) (void *, void *))
+ int (*hash_cmp) (const void *, const void *))
{
return hash_create_size (HASHTABSIZE, hash_key, hash_cmp);
}