[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/distribute.c b/lib/distribute.c
index 3d61621..906e3f6 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -134,7 +134,7 @@
/* If two distribute-list have same value then return 1 else return
0. This function is used by hash package. */
static int
-distribute_cmp (struct distribute *dist1, struct distribute *dist2)
+distribute_cmp (const struct distribute *dist1, const struct distribute *dist2)
{
if (dist1->ifname && dist2->ifname)
if (strcmp (dist1->ifname, dist2->ifname) == 0)
@@ -769,7 +769,7 @@
distribute_list_init (int node)
{
disthash = hash_create ((unsigned int (*) (void *)) distribute_hash_make,
- (int (*) (void *, void *)) distribute_cmp);
+ (int (*) (const void *, const void *)) distribute_cmp);
if(node==RIP_NODE) {
install_element (RIP_NODE, &distribute_list_all_cmd);