aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/radix.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-03 17:00:40 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-03 17:13:24 +0000
commitdfeb726476193fee3add70d91c665e0a1be83289 (patch)
treec9f2574d303aa33fecfe2e48cac9d4ee346c69f5 /src/libutil/radix.c
parent12baac84a70768643647ca23fa5932894b58b3ae (diff)
downloadrspamd-dfeb726476193fee3add70d91c665e0a1be83289.tar.gz
rspamd-dfeb726476193fee3add70d91c665e0a1be83289.zip
Constify radix tree search code
Diffstat (limited to 'src/libutil/radix.c')
-rw-r--r--src/libutil/radix.c15
1 files changed, 8 insertions, 7 deletions
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) {