diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-05-12 19:50:51 -0600 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-05-12 19:50:51 -0600 |
commit | b7b7eb9c05f3036da3f90b5cad03a3b47d1f7aa2 (patch) | |
tree | 9a5be3c1de61f22213e62a51418e4cb6820cdc33 /mysys/tree.c | |
parent | 64984296241873f90e39d744b59690c7b3b408bb (diff) | |
download | mariadb-git-b7b7eb9c05f3036da3f90b5cad03a3b47d1f7aa2.tar.gz |
option to free_root() to not my_free() the blocks
fixed bug/updated count_distinct2 test
changed reset in count distinct to avoid calls to my_free()
include/my_sys.h:
option to free_root() not to do my_free()
include/my_tree.h:
reset_tree()
mysql-test/r/count_distinct2.result:
added group by test
mysql-test/t/count_distinct2.test:
group by test + fixed bug - need to drop table
mysys/my_alloc.c:
mark_blocks_free()
mysys/tree.c:
reset_tree()
sql/item_sum.cc:
in count distinct reset_tree instead of delete_tree
Diffstat (limited to 'mysys/tree.c')
-rw-r--r-- | mysys/tree.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/mysys/tree.c b/mysys/tree.c index e46ff00adad..af64be55d2f 100644 --- a/mysys/tree.c +++ b/mysys/tree.c @@ -103,9 +103,9 @@ void init_tree(TREE *tree, uint default_alloc_size, int size, DBUG_VOID_RETURN; } -void delete_tree(TREE *tree) +static void free_tree(TREE *tree, myf free_flags) { - DBUG_ENTER("delete_tree"); + DBUG_ENTER("free_tree"); DBUG_PRINT("enter",("tree: %lx",tree)); if (tree->root) /* If initialized */ @@ -116,7 +116,7 @@ void delete_tree(TREE *tree) { if (tree->free) delete_tree_element(tree,tree->root); - free_root(&tree->mem_root,MYF(0)); + free_root(&tree->mem_root, free_flags); } } tree->root= &tree->null_element; @@ -125,6 +125,18 @@ void delete_tree(TREE *tree) DBUG_VOID_RETURN; } +void delete_tree(TREE* tree) +{ + free_tree(tree, MYF(0)); /* my_free() mem_root if applicable */ +} + +void reset_tree(TREE* tree) +{ + free_tree(tree, MYF(MY_MARK_BLOCKS_FREE)); + /* do not my_free() mem_root if applicable, just mark blocks as free */ +} + + static void delete_tree_element(TREE *tree, TREE_ELEMENT *element) { if (element != &tree->null_element) |