summaryrefslogtreecommitdiffstats
path: root/lib/skiplist.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-03-22 03:56:03 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2020-03-24 12:33:13 +0100
commit1a4189d4a1d2170f2fc3929b4e422e9c3b75a60a (patch)
tree62807bdcfbe5c8ee681fdeb623b5fe02aeab414e /lib/skiplist.c
parentbgpd: Make bgp_debug_bestpath take a `struct bgp_node` (diff)
downloadfrr-1a4189d4a1d2170f2fc3929b4e422e9c3b75a60a.tar.xz
frr-1a4189d4a1d2170f2fc3929b4e422e9c3b75a60a.zip
bgpd, isisd, lib: Make key values const for skiplist
Make some key values const for the skiplist code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/skiplist.c')
-rw-r--r--lib/skiplist.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/skiplist.c b/lib/skiplist.c
index d955c6eb9..fa25770ef 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 */
{