summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/rfapi/rfapi_ap.c6
-rw-r--r--bgpd/rfapi/rfapi_import.c17
-rw-r--r--bgpd/rfapi/rfapi_monitor.c6
-rw-r--r--bgpd/rfapi/rfapi_nve_addr.c6
-rw-r--r--bgpd/rfapi/rfapi_nve_addr.h2
-rw-r--r--bgpd/rfapi/rfapi_rib.c6
-rw-r--r--bgpd/rfapi/rfapi_rib.h2
-rw-r--r--bgpd/rfapi/rfapi_vty.c6
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c6
-rw-r--r--bgpd/rfapi/vnc_import_bgp.h2
-rw-r--r--isisd/fabricd.c4
-rw-r--r--isisd/isis_spf_private.h8
-rw-r--r--lib/skiplist.c11
-rw-r--r--lib/skiplist.h13
14 files changed, 49 insertions, 46 deletions
diff --git a/bgpd/rfapi/rfapi_ap.c b/bgpd/rfapi/rfapi_ap.c
index c5fda15d33..abb18aeb2c 100644
--- a/bgpd/rfapi/rfapi_ap.c
+++ b/bgpd/rfapi/rfapi_ap.c
@@ -81,10 +81,10 @@
* is used to spread out the sort for adbs with the same lifetime
* and thereby make the skip list operations more efficient.
*/
-static int sl_adb_lifetime_cmp(void *adb1, void *adb2)
+static int sl_adb_lifetime_cmp(const void *adb1, const void *adb2)
{
- struct rfapi_adb *a1 = adb1;
- struct rfapi_adb *a2 = adb2;
+ const struct rfapi_adb *a1 = adb1;
+ const struct rfapi_adb *a2 = adb2;
if (a1->lifetime < a2->lifetime)
return -1;
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index 5cb4fd5a10..6c50092e6a 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -2006,10 +2006,10 @@ static void rfapiBgpInfoDetach(struct agg_node *rn, struct bgp_path_info *bpi)
/*
* For L3-indexed import tables
*/
-static int rfapi_bi_peer_rd_cmp(void *b1, void *b2)
+static int rfapi_bi_peer_rd_cmp(const void *b1, const void *b2)
{
- struct bgp_path_info *bpi1 = b1;
- struct bgp_path_info *bpi2 = b2;
+ const struct bgp_path_info *bpi1 = b1;
+ const struct bgp_path_info *bpi2 = b2;
/*
* Compare peers
@@ -2022,8 +2022,9 @@ static int rfapi_bi_peer_rd_cmp(void *b1, void *b2)
/*
* compare RDs
*/
- return vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc.import.rd,
- (struct prefix *)&bpi2->extra->vnc.import.rd);
+ return vnc_prefix_cmp(
+ (const struct prefix *)&bpi1->extra->vnc.import.rd,
+ (const struct prefix *)&bpi2->extra->vnc.import.rd);
}
/*
@@ -2031,10 +2032,10 @@ static int rfapi_bi_peer_rd_cmp(void *b1, void *b2)
* The BPIs in these tables should ALWAYS have an aux_prefix set because
* they arrive via IPv4 or IPv6 advertisements.
*/
-static int rfapi_bi_peer_rd_aux_cmp(void *b1, void *b2)
+static int rfapi_bi_peer_rd_aux_cmp(const void *b1, const void *b2)
{
- struct bgp_path_info *bpi1 = b1;
- struct bgp_path_info *bpi2 = b2;
+ const struct bgp_path_info *bpi1 = b1;
+ const struct bgp_path_info *bpi2 = b2;
int rc;
/*
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index dc1f7e0fbb..74094efdf3 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -1103,10 +1103,10 @@ static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m)
m->rfd->response_lifetime, &m->timer);
}
-static int mon_eth_cmp(void *a, void *b)
+static int mon_eth_cmp(const void *a, const void *b)
{
- struct rfapi_monitor_eth *m1;
- struct rfapi_monitor_eth *m2;
+ const struct rfapi_monitor_eth *m1;
+ const struct rfapi_monitor_eth *m2;
int i;
diff --git a/bgpd/rfapi/rfapi_nve_addr.c b/bgpd/rfapi/rfapi_nve_addr.c
index ee54d88c3f..b8193f1431 100644
--- a/bgpd/rfapi/rfapi_nve_addr.c
+++ b/bgpd/rfapi/rfapi_nve_addr.c
@@ -58,10 +58,10 @@ static void logdifferent(const char *tag, struct rfapi_nve_addr *a,
#endif
-int rfapi_nve_addr_cmp(void *k1, void *k2)
+int rfapi_nve_addr_cmp(const void *k1, const void *k2)
{
- struct rfapi_nve_addr *a = (struct rfapi_nve_addr *)k1;
- struct rfapi_nve_addr *b = (struct rfapi_nve_addr *)k2;
+ const struct rfapi_nve_addr *a = (struct rfapi_nve_addr *)k1;
+ const struct rfapi_nve_addr *b = (struct rfapi_nve_addr *)k2;
int ret = 0;
if (!a || !b) {
diff --git a/bgpd/rfapi/rfapi_nve_addr.h b/bgpd/rfapi/rfapi_nve_addr.h
index 2d54d4a3cc..7bcb3cab69 100644
--- a/bgpd/rfapi/rfapi_nve_addr.h
+++ b/bgpd/rfapi/rfapi_nve_addr.h
@@ -30,7 +30,7 @@ struct rfapi_nve_addr {
};
-extern int rfapi_nve_addr_cmp(void *k1, void *k2);
+extern int rfapi_nve_addr_cmp(const void *k1, const void *k2);
extern void rfapiNveAddr2Str(struct rfapi_nve_addr *na, char *buf, int bufsize);
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 3d4bdef75a..141fb03d36 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -388,10 +388,10 @@ extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */
/*
* Compares two <struct rfapi_rib_key>s
*/
-int rfapi_rib_key_cmp(void *k1, void *k2)
+int rfapi_rib_key_cmp(const void *k1, const void *k2)
{
- struct rfapi_rib_key *a = (struct rfapi_rib_key *)k1;
- struct rfapi_rib_key *b = (struct rfapi_rib_key *)k2;
+ const struct rfapi_rib_key *a = (struct rfapi_rib_key *)k1;
+ const struct rfapi_rib_key *b = (struct rfapi_rib_key *)k2;
int ret;
if (!a || !b)
diff --git a/bgpd/rfapi/rfapi_rib.h b/bgpd/rfapi/rfapi_rib.h
index 38a6df9fbf..3ad021b4f4 100644
--- a/bgpd/rfapi/rfapi_rib.h
+++ b/bgpd/rfapi/rfapi_rib.h
@@ -147,7 +147,7 @@ extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */
struct prefix *aux, /* may be NULL */
struct rfapi_rib_key *rk);
-extern int rfapi_rib_key_cmp(void *k1, void *k2);
+extern int rfapi_rib_key_cmp(const void *k1, const void *k2);
extern void rfapiAdbFree(struct rfapi_adb *adb);
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index b18c9e07b5..aa9c216959 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -2754,10 +2754,10 @@ static void nve_addr_free(void *hap)
XFREE(MTYPE_RFAPI_NVE_ADDR, hap);
}
-static int nve_addr_cmp(void *k1, void *k2)
+static int nve_addr_cmp(const void *k1, const void *k2)
{
- struct nve_addr *a = (struct nve_addr *)k1;
- struct nve_addr *b = (struct nve_addr *)k2;
+ const struct nve_addr *a = (struct nve_addr *)k1;
+ const struct nve_addr *b = (struct nve_addr *)k2;
int ret = 0;
if (!a || !b) {
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index ba6ef14257..d5e509d30d 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -128,14 +128,14 @@ struct prefix_bag {
static const uint8_t maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
0xf8, 0xfc, 0xfe, 0xff};
-int vnc_prefix_cmp(void *pfx1, void *pfx2)
+int vnc_prefix_cmp(const void *pfx1, const void *pfx2)
{
int offset;
int shift;
uint8_t mask;
- struct prefix *p1 = pfx1;
- struct prefix *p2 = pfx2;
+ const struct prefix *p1 = pfx1;
+ const struct prefix *p2 = pfx2;
if (p1->family < p2->family)
return -1;
diff --git a/bgpd/rfapi/vnc_import_bgp.h b/bgpd/rfapi/vnc_import_bgp.h
index 3db6f4010a..ca64e6eacc 100644
--- a/bgpd/rfapi/vnc_import_bgp.h
+++ b/bgpd/rfapi/vnc_import_bgp.h
@@ -32,7 +32,7 @@
extern uint32_t calc_local_pref(struct attr *attr, struct peer *peer);
-extern int vnc_prefix_cmp(void *pfx1, void *pfx2);
+extern int vnc_prefix_cmp(const void *pfx1, const void *pfx2);
extern void vnc_import_bgp_add_route(struct bgp *bgp, struct prefix *prefix,
struct bgp_path_info *info);
diff --git a/isisd/fabricd.c b/isisd/fabricd.c
index b9c27d51bd..28cc65380f 100644
--- a/isisd/fabricd.c
+++ b/isisd/fabricd.c
@@ -122,9 +122,9 @@ static bool neighbor_entry_hash_cmp(const void *a, const void *b)
return memcmp(na->id, nb->id, sizeof(na->id)) == 0;
}
-static int neighbor_entry_list_cmp(void *a, void *b)
+static int neighbor_entry_list_cmp(const void *a, const void *b)
{
- struct neighbor_entry *na = a, *nb = b;
+ const struct neighbor_entry *na = a, *nb = b;
return -memcmp(na->id, nb->id, sizeof(na->id));
}
diff --git a/isisd/isis_spf_private.h b/isisd/isis_spf_private.h
index a8185a8be0..05aae14b94 100644
--- a/isisd/isis_spf_private.h
+++ b/isisd/isis_spf_private.h
@@ -117,11 +117,11 @@ static bool isis_vertex_queue_hash_cmp(const void *a, const void *b)
* Compares vertizes for sorting in the TENT list. Returns true
* if candidate should be considered before current, false otherwise.
*/
-__attribute__((__unused__))
-static int isis_vertex_queue_tent_cmp(void *a, void *b)
+__attribute__((__unused__)) static int isis_vertex_queue_tent_cmp(const void *a,
+ const void *b)
{
- struct isis_vertex *va = a;
- struct isis_vertex *vb = b;
+ const struct isis_vertex *va = a;
+ const struct isis_vertex *vb = b;
if (va->d_N < vb->d_N)
return -1;
diff --git a/lib/skiplist.c b/lib/skiplist.c
index d955c6eb9e..fa25770efa 100644
--- a/lib/skiplist.c
+++ b/lib/skiplist.c
@@ -112,7 +112,7 @@ static int randomLevel(void)
return level;
}
-static int default_cmp(void *key1, void *key2)
+static int default_cmp(const void *key1, const void *key2)
{
if (key1 < key2)
return -1;
@@ -126,7 +126,8 @@ unsigned int skiplist_count(struct skiplist *l)
return l->count;
}
-struct skiplist *skiplist_new(int flags, int (*cmp)(void *key1, void *key2),
+struct skiplist *skiplist_new(int flags,
+ int (*cmp)(const void *key1, const void *key2),
void (*del)(void *val))
{
struct skiplist *new;
@@ -329,8 +330,8 @@ int skiplist_delete(register struct skiplist *l, register void *key,
* Also set a cursor for use with skiplist_next_value.
*/
int skiplist_first_value(register struct skiplist *l, /* in */
- register void *key, /* in */
- void **valuePointer, /* out */
+ register const void *key, /* in */
+ void **valuePointer, /* out */
void **cursor) /* out */
{
register int k;
@@ -374,7 +375,7 @@ int skiplist_search(register struct skiplist *l, register void *key,
* last element with the given key, -1 is returned.
*/
int skiplist_next_value(register struct skiplist *l, /* in */
- register void *key, /* in */
+ register const void *key, /* in */
void **valuePointer, /* in/out */
void **cursor) /* in/out */
{
diff --git a/lib/skiplist.h b/lib/skiplist.h
index 2ab37331c9..a106a455d6 100644
--- a/lib/skiplist.h
+++ b/lib/skiplist.h
@@ -68,7 +68,7 @@ struct skiplist {
* Returns -1 if val1 < val2, 0 if equal?, 1 if val1 > val2.
* Used as definition of sorted for listnode_add_sort
*/
- int (*cmp)(void *val1, void *val2);
+ int (*cmp)(const void *val1, const void *val2);
/* callback to free user-owned data when listnode is deleted. supplying
* this callback is very much encouraged!
@@ -81,8 +81,9 @@ struct skiplist {
extern struct skiplist *
skiplist_new(/* encouraged: set list.del callback on new lists */
int flags,
- int (*cmp)(void *key1, void *key2), /* NULL => default cmp */
- void (*del)(void *val)); /* NULL => no auto val free */
+ int (*cmp)(const void *key1,
+ const void *key2), /* NULL => default cmp */
+ void (*del)(void *val)); /* NULL => no auto val free */
extern void skiplist_free(struct skiplist *);
@@ -96,12 +97,12 @@ extern int skiplist_search(register struct skiplist *l, register void *key,
void **valuePointer);
extern int skiplist_first_value(register struct skiplist *l, /* in */
- register void *key, /* in */
- void **valuePointer, /* in/out */
+ register const void *key, /* in */
+ void **valuePointer, /* in/out */
void **cursor); /* out */
extern int skiplist_next_value(register struct skiplist *l, /* in */
- register void *key, /* in */
+ register const void *key, /* in */
void **valuePointer, /* in/out */
void **cursor); /* in/out */