summaryrefslogtreecommitdiff
path: root/mysys/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/tree.c')
-rw-r--r--mysys/tree.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mysys/tree.c b/mysys/tree.c
index 1bd49ef5182..489262fcdc7 100644
--- a/mysys/tree.c
+++ b/mysys/tree.c
@@ -86,6 +86,7 @@ void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
tree->custom_arg = custom_arg;
tree->null_element.colour=BLACK;
tree->null_element.left=tree->null_element.right=0;
+ tree->flag= 0;
if (!free_element && size >= 0 &&
((uint) size <= sizeof(void*) || ((uint) size & (sizeof(void*)-1))))
{
@@ -231,7 +232,11 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size,
rb_insert(tree,parent,element); /* rebalance tree */
}
else
+ {
+ if (tree->flag & TREE_NO_DUPS)
+ return(NULL);
element->count++;
+ }
DBUG_EXECUTE("check_tree", test_rb_tree(tree->root););
return element;
}