diff options
author | unknown <monty@mashka.mysql.fi> | 2004-03-04 10:07:32 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2004-03-04 10:07:32 +0200 |
commit | 96a1f9d72e78de244880eaad65358f4a1d92c117 (patch) | |
tree | c46614146745f57ac8c51d0ea0d932e5c24df7ca /mysys | |
parent | e269e9c95fad613b8b0152642a317e2082323230 (diff) | |
parent | afa6728a9f7c00582b3dc9e96b2dce5c4ac1e56c (diff) | |
download | mariadb-git-96a1f9d72e78de244880eaad65358f4a1d92c117.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mashka.mysql.fi:/home/my/mysql-4.1
sql/item_create.cc:
Auto merged
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/hash.c | 6 | ||||
-rw-r--r-- | mysys/tree.c | 21 |
2 files changed, 16 insertions, 11 deletions
diff --git a/mysys/hash.c b/mysys/hash.c index 4ef8847363f..64a4242e0f7 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -215,9 +215,9 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length) { uint rec_keylength; byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1); - return (length && length != rec_keylength) || - my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength, - (uchar*) key, length); + return ((length && length != rec_keylength) || + my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength, + (uchar*) key, length)); } diff --git a/mysys/tree.c b/mysys/tree.c index 42c58131100..0b30ffa4971 100644 --- a/mysys/tree.c +++ b/mysys/tree.c @@ -170,8 +170,8 @@ void delete_tree(TREE* tree) void reset_tree(TREE* tree) { + /* do not free mem_root, just mark blocks as free */ free_tree(tree, MYF(MY_MARK_BLOCKS_FREE)); - /* do not my_free() mem_root if applicable, just mark blocks as free */ } @@ -188,10 +188,14 @@ static void delete_tree_element(TREE *tree, TREE_ELEMENT *element) } } - /* Code for insert, search and delete of elements */ - /* parent[0] = & parent[-1][0]->left || - parent[0] = & parent[-1][0]->right */ +/* + insert, search and delete of elements + + The following should be true: + parent[0] = & parent[-1][0]->left || + parent[0] = & parent[-1][0]->right +*/ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size, void* custom_arg) @@ -232,8 +236,7 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size, if (tree->with_delete) element=(TREE_ELEMENT *) my_malloc(alloc_size, MYF(MY_WME)); else - element=(TREE_ELEMENT *) - alloc_root(&tree->mem_root,alloc_size); + element=(TREE_ELEMENT *) alloc_root(&tree->mem_root,alloc_size); if (!element) return(NULL); **parent=element; @@ -251,9 +254,9 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size, } else memcpy((byte*) element+tree->offset_to_key,key,(size_t) key_size); - element->count=1; /* May give warning in purify */ + element->count=1; /* May give warning in purify */ tree->elements_in_tree++; - rb_insert(tree,parent,element); /* rebalance tree */ + rb_insert(tree,parent,element); /* rebalance tree */ } else { @@ -320,6 +323,8 @@ int tree_delete(TREE *tree, void *key, void *custom_arg) rb_delete_fixup(tree,parent); if (tree->free) (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); + /* This doesn't include key_size, but better than nothing */ + tree->allocated-= sizeof(TREE_ELEMENT)+tree->size_of_element; my_free((gptr) element,MYF(0)); tree->elements_in_tree--; return 0; |