~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_scan.c

  • Committer: Monty Taylor
  • Date: 2008-10-16 06:32:30 UTC
  • mto: (511.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: monty@inaugust.com-20081016063230-4brxsra0qsmsg84q
Added -Wunused-macros.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
int heap_scan_init(register HP_INFO *info)
28
28
{
29
 
  DBUG_ENTER("heap_scan_init");
30
29
  info->lastinx= -1;
31
 
  info->current_record= (ulong) ~0L;            /* No current record */
 
30
  info->current_record= UINT32_MAX;             /* No current record */
32
31
  info->update=0;
33
32
  info->next_block=0;
34
 
  DBUG_RETURN(0);
 
33
  return(0);
35
34
}
36
35
 
37
 
int heap_scan(register HP_INFO *info, uchar *record)
 
36
int heap_scan(register HP_INFO *info, unsigned char *record)
38
37
{
39
38
  HP_SHARE *share=info->s;
40
 
  ulong pos;
41
 
  DBUG_ENTER("heap_scan");
 
39
  uint32_t pos;
42
40
 
43
41
  pos= ++info->current_record;
44
42
  if (pos < info->next_block)
45
43
  {
46
 
    info->current_ptr+=share->block.recbuffer;
 
44
    info->current_ptr+=share->recordspace.block.recbuffer;
47
45
  }
48
46
  else
49
47
  {
50
 
    info->next_block+=share->block.records_in_block;
51
 
    if (info->next_block >= share->records+share->deleted)
 
48
    info->next_block+=share->recordspace.block.records_in_block;
 
49
    if (info->next_block >= share->recordspace.chunk_count)
52
50
    {
53
 
      info->next_block= share->records+share->deleted;
 
51
      info->next_block= share->recordspace.chunk_count;
54
52
      if (pos >= info->next_block)
55
53
      {
56
54
        info->update= 0;
57
 
        DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE);
 
55
        return(my_errno= HA_ERR_END_OF_FILE);
58
56
      }
59
57
    }
60
58
    hp_find_record(info, pos);
61
59
  }
62
 
  if (!info->current_ptr[share->reclength])
 
60
  if (get_chunk_status(&share->recordspace, info->current_ptr) != CHUNK_STATUS_ACTIVE)
63
61
  {
64
 
    DBUG_PRINT("warning",("Found deleted record"));
65
62
    info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
66
 
    DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
 
63
    return(my_errno=HA_ERR_RECORD_DELETED);
67
64
  }
68
65
  info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
69
 
  memcpy(record,info->current_ptr,(size_t) share->reclength);
 
66
  hp_extract_record(share, record, info->current_ptr);
70
67
  info->current_hash_ptr=0;                     /* Can't use read_next */
71
 
  DBUG_RETURN(0);
 
68
  return(0);
72
69
} /* heap_scan */