~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_rkey.c

  • Committer: Monty Taylor
  • Date: 2008-07-22 05:48:51 UTC
  • mto: (202.1.3 toru)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: monty@inaugust.com-20080722054851-airxt73370725p7x
Re-enabled optimizations for the normal build, and added back the --with-debug option to turn them off. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include "heapdef.h"
17
17
 
18
 
int heap_rkey(HP_INFO *info, unsigned char *record, int inx, const unsigned char *key, 
 
18
int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key, 
19
19
              key_part_map keypart_map, enum ha_rkey_function find_flag)
20
20
{
21
 
  unsigned char *pos;
 
21
  uchar *pos;
22
22
  HP_SHARE *share= info->s;
23
23
  HP_KEYDEF *keyinfo= share->keydef + inx;
24
24
 
27
27
    return(my_errno= HA_ERR_WRONG_INDEX);
28
28
  }
29
29
  info->lastinx= inx;
30
 
  info->current_record= UINT32_MAX;             /* For heap_rrnd() */
 
30
  info->current_record= (ulong) ~0L;            /* For heap_rrnd() */
31
31
 
32
32
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
33
33
  {
35
35
 
36
36
    custom_arg.keyseg= info->s->keydef[inx].seg;
37
37
    custom_arg.key_length= info->lastkey_len= 
38
 
      hp_rb_pack_key(keyinfo, (unsigned char*) info->lastkey,
39
 
                     (unsigned char*) key, keypart_map);
 
38
      hp_rb_pack_key(keyinfo, (uchar*) info->lastkey,
 
39
                     (uchar*) key, keypart_map);
40
40
    custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME;
41
41
    /* for next rkey() after deletion */
42
42
    if (find_flag == HA_READ_AFTER_KEY)
51
51
      info->update= 0;
52
52
      return(my_errno= HA_ERR_KEY_NOT_FOUND);
53
53
    }
54
 
    memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(unsigned char*));
 
54
    memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(uchar*));
55
55
    info->current_ptr= pos;
56
56
  }
57
57
  else
64
64
    if (!(keyinfo->flag & HA_NOSAME))
65
65
      memcpy(info->lastkey, key, (size_t) keyinfo->length);
66
66
  }
67
 
  hp_extract_record(share, record, pos);
 
67
  memcpy(record, pos, (size_t) share->reclength);
68
68
  info->update= HA_STATE_AKTIV;
69
69
  return(0);
70
70
}
72
72
 
73
73
        /* Quick find of record */
74
74
 
75
 
unsigned char* heap_find(HP_INFO *info, int inx, const unsigned char *key)
 
75
uchar* heap_find(HP_INFO *info, int inx, const uchar *key)
76
76
{
77
77
  return hp_search(info, info->s->keydef + inx, key, 0);
78
78
}