summaryrefslogtreecommitdiff
path: root/myisam/rt_index.c
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-11-04 14:09:03 +0200
committerunknown <monty@narttu.mysql.fi>2003-11-04 14:09:03 +0200
commit0712ce9ec5d3b84acfcb33ebe8b653ed6e0f084c (patch)
tree07ce6a4f792ac489b079759afb3cc65847ca0cb0 /myisam/rt_index.c
parentf97f48acaf26aebc3f79de34b21607e11e1b91fa (diff)
downloadmariadb-git-0712ce9ec5d3b84acfcb33ebe8b653ed6e0f084c.tar.gz
Removed some warnings reported by valgrind
After merge fixes. Now code compiles, but there is still some valgrind warnings that needs to be fixed myisam/mi_rnext_same.c: handle case where rtree_find_next() returns an error (assume this means that there was no more keys) myisam/rt_index.c: Code cleanup mysql-test/r/func_crypt.result: Update results mysql-test/r/func_group.result: Update results mysql-test/r/null_key.result: Update results mysql-test/r/order_by.result: Update results mysql-test/r/query_cache.result: Update results mysql-test/r/range.result: Update results mysql-test/r/rpl_trunc_binlog.result: Update results mysql-test/t/fulltext.test: Fix error numbers mysql-test/t/func_crypt.test: Fixed test for 4.1 mysql-test/t/range.test: Moved tests to be in sync with 4.0 mysys/test_charset.c: Removed acccess to non existing functions sql-common/client.c: Merge fix sql/item_strfunc.cc: Simple code cleanup Don't call ->c_ptr() when you don't need a 0 terminated string (Causes warnings from valgrind) sql/log_event.cc: After merge fixes sql/protocol.cc: Change default catalog name to 'def' sql/spatial.cc: Code cleanup sql/sql_class.cc: After merge fixes sql/time.cc: Ensure that time object is cleared on error sql/unireg.cc: Removed warning reported by valgrind
Diffstat (limited to 'myisam/rt_index.c')
-rw-r--r--myisam/rt_index.c94
1 files changed, 54 insertions, 40 deletions
diff --git a/myisam/rt_index.c b/myisam/rt_index.c
index 8b877d2e65c..c49c204ce7b 100644
--- a/myisam/rt_index.c
+++ b/myisam/rt_index.c
@@ -36,16 +36,21 @@ typedef struct st_page_list
stPageLevel *pages;
} stPageList;
+
/*
-Find next key in r-tree according to search_flag recursively
-Used in rtree_find_first() and rtree_find_next()
-Result values:
--1 - error
- 0 - found
- 1 - not found
+ Find next key in r-tree according to search_flag recursively
+
+ NOTES
+ Used in rtree_find_first() and rtree_find_next()
+
+ RETURN
+ -1 Error
+ 0 Found
+ 1 Not found
*/
-static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, uint nod_cmp_flag,
- my_off_t page, int level)
+
+static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
+ uint nod_cmp_flag, my_off_t page, int level)
{
uchar *k;
uchar *last;
@@ -143,13 +148,24 @@ err1:
return -1;
}
+
/*
-Find first key in r-tree according to search_flag condition
-Result values:
--1 - error
- 0 - found
- 1 - not found
+ Find first key in r-tree according to search_flag condition
+
+ SYNOPSIS
+ rtree_find_first()
+ info Handler to MyISAM file
+ uint keynr Key number to use
+ key Key to search for
+ key_length Length of 'key'
+ search_flag Bitmap of flags how to do the search
+
+ RETURN
+ -1 Error
+ 0 Found
+ 1 Not found
*/
+
int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
uint search_flag)
{
@@ -175,13 +191,16 @@ int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
return rtree_find_req(info, keyinfo, search_flag, nod_cmp_flag, root, 0);
}
+
/*
-Find next key in r-tree according to search_flag condition
-Result values:
--1 - error
- 0 - found
- 1 - not found
+ Find next key in r-tree according to search_flag condition
+
+ RETURN
+ -1 Error
+ 0 Found
+ 1 Not found
*/
+
int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
{
my_off_t root;
@@ -189,14 +208,12 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
if (info->update & HA_STATE_DELETED)
- {
return rtree_find_first(info, keynr, info->lastkey, info->lastkey_length,
search_flag);
- }
-
+
if (!info->buff_used)
{
- uchar *key = info->int_keypos;
+ uchar *key= info->int_keypos;
while (key < info->int_maxpos)
{
@@ -205,24 +222,16 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
{
uchar *after_key = key + keyinfo->keylength;
- info->lastpos = _mi_dpos(info, 0, after_key);
+ info->lastpos= _mi_dpos(info, 0, after_key);
memcpy(info->lastkey, key, info->lastkey_length);
if (after_key < info->int_maxpos)
- {
- info->int_keypos = after_key;
- }
+ info->int_keypos= after_key;
else
- {
- info->buff_used = 1;
- }
-
+ info->buff_used= 1;
return 0;
}
- else
- {
- key += keyinfo->keylength;
- }
+ key+= keyinfo->keylength;
}
}
if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
@@ -236,14 +245,19 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
return rtree_find_req(info, keyinfo, search_flag, nod_cmp_flag, root, 0);
}
+
/*
-Get next key in r-tree recursively
-Used in rtree_get_first() and rtree_get_next()
-Result values:
--1 - error
- 0 - found
- 1 - not found
+ Get next key in r-tree recursively
+
+ NOTES
+ Used in rtree_get_first() and rtree_get_next()
+
+ RETURN
+ -1 Error
+ 0 Found
+ 1 Not found
*/
+
static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
my_off_t page, int level)
{