From dfeb726476193fee3add70d91c665e0a1be83289 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 3 Jan 2016 17:00:40 +0000 Subject: Constify radix tree search code --- src/libutil/radix.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/libutil/radix.c') diff --git a/src/libutil/radix.c b/src/libutil/radix.c index a6a49025a..11acc4f8a 100644 --- a/src/libutil/radix.c +++ b/src/libutil/radix.c @@ -70,10 +70,10 @@ struct radix_tree_compressed { static gboolean radix_compare_compressed (struct radix_compressed_node *node, - guint8 *key, guint keylen, guint cur_level) + const guint8 *key, guint keylen, guint cur_level) { - guint8 *nk; - guint8 *k; + const guint8 *nk; + const guint8 *k; guint8 bit; guint shift, rbits, skip; @@ -118,13 +118,13 @@ radix_compare_compressed (struct radix_compressed_node *node, } uintptr_t -radix_find_compressed (radix_compressed_t * tree, guint8 *key, gsize keylen) +radix_find_compressed (radix_compressed_t * tree, const guint8 *key, gsize keylen) { struct radix_compressed_node *node; guint32 bit; gsize kremain = keylen / sizeof (guint32); uintptr_t value; - guint32 *k = (guint32 *)key; + const guint32 *k = (guint32 *)key; guint32 kv = ntohl (*k); guint cur_level = 0; @@ -594,9 +594,10 @@ radix_destroy_compressed (radix_compressed_t *tree) } uintptr_t -radix_find_compressed_addr (radix_compressed_t *tree, rspamd_inet_addr_t *addr) +radix_find_compressed_addr (radix_compressed_t *tree, + const rspamd_inet_addr_t *addr) { - guchar *key; + const guchar *key; guint klen = 0; if (addr == NULL) { -- cgit v1.2.3