aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-16 18:29:02 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-16 18:29:02 +0100
commit0165d618a35df03a94ef0a53a0fbfe5f98b3462e (patch)
tree35e7761a9f8a2e410676e1c4d0e0e14e69837834 /src
parent546c7aa532c0b7170a49446f156278574525626d (diff)
downloadrspamd-0165d618a35df03a94ef0a53a0fbfe5f98b3462e.tar.gz
rspamd-0165d618a35df03a94ef0a53a0fbfe5f98b3462e.zip
Fix radix leaf nodes insertion.
Diffstat (limited to 'src')
-rw-r--r--src/libutil/radix.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libutil/radix.c b/src/libutil/radix.c
index cd40c7905..29c32ab62 100644
--- a/src/libutil/radix.c
+++ b/src/libutil/radix.c
@@ -430,6 +430,7 @@ radix_uncompress_path (struct radix_compressed_node *node,
node->skipped = FALSE;
msg_debug ("uncompress %ud levels of tree", levels_uncompress);
+
while (levels_uncompress) {
next = g_slice_alloc (sizeof (*node));
@@ -457,6 +458,7 @@ radix_uncompress_path (struct radix_compressed_node *node,
}
/* Attach leaf node */
+ msg_debug ("attach leaf node with value %p", leaf->value);
if (*nkey & bit) {
node->d.n.right = leaf;
node->d.n.left = NULL;
@@ -490,6 +492,7 @@ radix_make_leaf_node (guint8 *key, gsize keylen, gsize masklen,
memset (node, 0, sizeof (*node));
}
node->value = value;
+ msg_debug ("insert new leaf node with value %p", value);
return node;
}
@@ -532,6 +535,7 @@ radix_uncompress_node (struct radix_compressed_node *node,
/* Nodes are equal */
uintptr_t oldval = node->value;
node->value = value;
+ msg_debug ("replace leaf node with: %p, old value: %p", value, oldval);
return oldval;
}
else {
@@ -551,11 +555,12 @@ radix_uncompress_node (struct radix_compressed_node *node,
* - otherwise we insert new compressed leaf node
*/
if (cur_level == target_level) {
+ msg_debug ("insert detached leaf node with value: %p", value);
nnode->value = value;
}
else {
- node = radix_make_leaf_node (key, keylen, value,
- keylen - target_level / NBBY, TRUE);
+ node = radix_make_leaf_node (key, keylen,
+ keylen - target_level / NBBY, value, TRUE);
if (nnode->d.n.left == NULL) {
nnode->d.n.left = node;
}
@@ -586,6 +591,7 @@ radix_insert_compressed (radix_compressed_t * tree,
node = tree->root;
g_assert (keybits >= masklen);
+ msg_debug ("want insert value %p with mask %z", value, masklen);
node = tree->root;
prev = &tree->root;