[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/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 38c9caa..006fc91 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -1347,10 +1347,10 @@
 /* Compare leftmost AS value for MED check.  If as1's leftmost AS and
    as2's leftmost AS is same return 1. */
 int
-aspath_cmp_left (struct aspath *aspath1, struct aspath *aspath2)
+aspath_cmp_left (const struct aspath *aspath1, const struct aspath *aspath2)
 {
-  struct assegment *seg1 = NULL;
-  struct assegment *seg2 = NULL;
+  const struct assegment *seg1 = NULL;
+  const struct assegment *seg2 = NULL;
 
   if (!(aspath1 && aspath2))
     return 0;
@@ -1484,7 +1484,7 @@
    as2's leftmost AS is same return 1. (confederation as-path
    only).  */
 int
-aspath_cmp_left_confed (struct aspath *aspath1, struct aspath *aspath2)
+aspath_cmp_left_confed (const struct aspath *aspath1, const struct aspath *aspath2)
 {
   if (! (aspath1 && aspath2) )
     return 0;
@@ -1769,10 +1769,10 @@
 
 /* If two aspath have same value then return 1 else return 0 */
 static int
-aspath_cmp (void *arg1, void *arg2)
+aspath_cmp (const void *arg1, const void *arg2)
 {
-  struct assegment *seg1 = ((struct aspath *)arg1)->segments;
-  struct assegment *seg2 = ((struct aspath *)arg2)->segments;
+  const struct assegment *seg1 = ((struct aspath *)arg1)->segments;
+  const struct assegment *seg2 = ((struct aspath *)arg2)->segments;
   
   while (seg1 || seg2)
     {