diff options
author | unknown <ram@gw.udmsearch.izhnet.ru> | 2002-05-23 19:26:16 +0500 |
---|---|---|
committer | unknown <ram@gw.udmsearch.izhnet.ru> | 2002-05-23 19:26:16 +0500 |
commit | c1f3be5bb5f70e5d0376f258b79ccffa5b2d9c2b (patch) | |
tree | c5a8cbf56ea21127e0ba4d444db78aa46cbe0925 /heap/hp_rkey.c | |
parent | e494b724d0b3100d325a6dd9f59c004b3bb71c1c (diff) | |
download | mariadb-git-c1f3be5bb5f70e5d0376f258b79ccffa5b2d9c2b.tar.gz |
Heap table code cleanup
Diffstat (limited to 'heap/hp_rkey.c')
-rw-r--r-- | heap/hp_rkey.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/heap/hp_rkey.c b/heap/hp_rkey.c index 502e97e2f06..4e47fd52e9b 100644 --- a/heap/hp_rkey.c +++ b/heap/hp_rkey.c @@ -20,56 +20,56 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key, uint key_len, enum ha_rkey_function find_flag) { byte *pos; - HP_SHARE *share=info->s; - HP_KEYDEF *keyinfo = share->keydef+inx; + HP_SHARE *share= info->s; + HP_KEYDEF *keyinfo= share->keydef + inx; DBUG_ENTER("heap_rkey"); DBUG_PRINT("enter",("base: %lx inx: %d",info,inx)); if ((uint) inx >= share->keys) { - DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX); + DBUG_RETURN(my_errno= HA_ERR_WRONG_INDEX); } - info->lastinx=inx; - info->current_record = (ulong) ~0L; /* For heap_rrnd() */ + info->lastinx= inx; + info->current_record= (ulong) ~0L; /* For heap_rrnd() */ if (keyinfo->algorithm == HA_KEY_ALG_BTREE) { heap_rb_param custom_arg; - hp_rb_pack_key(info, inx, info->recbuf, key, key_len); + hp_rb_pack_key(keyinfo, info->recbuf, key); - custom_arg.keyseg = info->s->keydef[inx].seg; - custom_arg.key_length = key_len; - custom_arg.search_flag = SEARCH_FIND | SEARCH_SAME; + custom_arg.keyseg= info->s->keydef[inx].seg; + custom_arg.key_length= key_len; + custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME; /* for next rkey() after deletion */ if (find_flag == HA_READ_AFTER_KEY) - info->last_find_flag = HA_READ_KEY_OR_NEXT; + info->last_find_flag= HA_READ_KEY_OR_NEXT; else if (find_flag == HA_READ_BEFORE_KEY) - info->last_find_flag = HA_READ_KEY_OR_PREV; + info->last_find_flag= HA_READ_KEY_OR_PREV; else - info->last_find_flag = find_flag; - info->lastkey_len = key_len; - if (!(pos = tree_search_key(&keyinfo->rb_tree, info->recbuf, info->parents, - &info->last_pos, find_flag, &custom_arg))) + info->last_find_flag= find_flag; + info->lastkey_len= key_len; + if (!(pos= tree_search_key(&keyinfo->rb_tree, info->recbuf, info->parents, + &info->last_pos, find_flag, &custom_arg))) { - info->update = 0; - DBUG_RETURN(my_errno = HA_ERR_KEY_NOT_FOUND); + info->update= 0; + DBUG_RETURN(my_errno= HA_ERR_KEY_NOT_FOUND); } - memcpy(&pos, pos + hp_rb_key_length(keyinfo, pos), sizeof(byte*)); - info->current_ptr = pos; + memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(byte*)); + info->current_ptr= pos; } else { - if (!(pos=hp_search(info,share->keydef+inx,key,0))) + if (!(pos= hp_search(info, share->keydef + inx, key, 0))) { - info->update=0; + info->update= 0; DBUG_RETURN(my_errno); } if (!(keyinfo->flag & HA_NOSAME)) - memcpy(info->lastkey,key,(size_t) keyinfo->length); + memcpy(info->lastkey, key, (size_t) keyinfo->length); } - memcpy(record,pos,(size_t) share->reclength); - info->update=HA_STATE_AKTIV; + memcpy(record, pos, (size_t) share->reclength); + info->update= HA_STATE_AKTIV; DBUG_RETURN(0); } |