summaryrefslogtreecommitdiff
path: root/heap/hp_hash.c
diff options
context:
space:
mode:
authorunknown <ram@gw.udmsearch.izhnet.ru>2002-05-23 19:26:16 +0500
committerunknown <ram@gw.udmsearch.izhnet.ru>2002-05-23 19:26:16 +0500
commitc1f3be5bb5f70e5d0376f258b79ccffa5b2d9c2b (patch)
treec5a8cbf56ea21127e0ba4d444db78aa46cbe0925 /heap/hp_hash.c
parente494b724d0b3100d325a6dd9f59c004b3bb71c1c (diff)
downloadmariadb-git-c1f3be5bb5f70e5d0376f258b79ccffa5b2d9c2b.tar.gz
Heap table code cleanup
Diffstat (limited to 'heap/hp_hash.c')
-rw-r--r--heap/hp_hash.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index f170df4fdb8..424322fd5e7 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -26,16 +26,17 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
enum ha_rkey_function end_search_flag)
{
ha_rows start_pos, end_pos;
- TREE *rb_tree = &info->s->keydef[inx].rb_tree;
+ HP_KEYDEF *keyinfo= info->s->keydef + inx;
+ TREE *rb_tree = &keyinfo->rb_tree;
heap_rb_param custom_arg;
info->lastinx = inx;
- custom_arg.keyseg = info->s->keydef[inx].seg;
+ custom_arg.keyseg = keyinfo->seg;
custom_arg.search_flag = SEARCH_FIND | SEARCH_SAME;
custom_arg.key_length = start_key_len;
if (start_key)
{
- hp_rb_pack_key(info, inx, info->recbuf, start_key, start_key_len);
+ hp_rb_pack_key(keyinfo, info->recbuf, start_key);
start_pos= tree_record_pos(rb_tree, info->recbuf, start_search_flag,
&custom_arg);
}
@@ -47,7 +48,7 @@ ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, const byte *start_key,
custom_arg.key_length = end_key_len;
if (end_key)
{
- hp_rb_pack_key(info, inx, info->recbuf, end_key, end_key_len);
+ hp_rb_pack_key(keyinfo, info->recbuf, end_key);
end_pos= tree_record_pos(rb_tree, info->recbuf, end_search_flag,
&custom_arg);
}
@@ -473,12 +474,10 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
return key - start_key;
}
-uint hp_rb_pack_key(HP_INFO *info, uint inx, uchar *key, const uchar *old,
- uint k_length)
+uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old)
{
HA_KEYSEG *seg, *endseg;
uchar *start_key= key;
- HP_KEYDEF *keydef= info->s->keydef + inx;
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg;
old+= seg->length, seg++)
@@ -494,28 +493,24 @@ uint hp_rb_pack_key(HP_INFO *info, uint inx, uchar *key, const uchar *old,
return key - start_key;
}
-uint hp_rb_key_length(HP_KEYDEF *keydef, const byte *key)
+uint hp_rb_key_length(HP_KEYDEF *keydef,
+ const byte *key __attribute__((unused)))
+{
+ return keydef->length;
+}
+
+uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
{
const byte *start_key= key;
HA_KEYSEG *seg, *endseg;
- if (keydef->flag & HA_NULL_PART_KEY)
- {
- for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
- {
- if (seg->null_bit)
- {
- if (!*key++)
- continue;
- }
- key += seg->length;
- }
- return key - start_key;
- }
- else
+ for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
{
- return keydef->length;
+ if (seg->null_bit && !*key++)
+ continue;
+ key+= seg->length;
}
+ return key - start_key;
}
/*