~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_rrnd.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:
24
24
           HA_ERR_END_OF_FILE = EOF.
25
25
*/
26
26
 
27
 
int heap_rrnd(register HP_INFO *info, uchar *record, uchar *pos)
 
27
int heap_rrnd(register HP_INFO *info, unsigned char *record, unsigned char *pos)
28
28
{
29
29
  HP_SHARE *share=info->s;
30
 
  DBUG_ENTER("heap_rrnd");
31
 
  DBUG_PRINT("enter",("info: 0x%lx  pos: %lx",(long) info, (long) pos));
32
30
 
33
31
  info->lastinx= -1;
34
32
  if (!(info->current_ptr= pos))
35
33
  {
36
34
    info->update= 0;
37
 
    DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE);
 
35
    return(my_errno= HA_ERR_END_OF_FILE);
38
36
  }
39
 
  if (!info->current_ptr[share->reclength])
 
37
  if (get_chunk_status(&share->recordspace, info->current_ptr) != CHUNK_STATUS_ACTIVE)
40
38
  {
 
39
    /* treat deleted and linked chunks as deleted */
41
40
    info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
42
 
    DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
 
41
    return(my_errno=HA_ERR_RECORD_DELETED);
43
42
  }
44
43
  info->update=HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
45
 
  memcpy(record,info->current_ptr,(size_t) share->reclength);
46
 
  DBUG_PRINT("exit", ("found record at 0x%lx", (long) info->current_ptr));
 
44
  hp_extract_record(share, record, info->current_ptr);
47
45
  info->current_hash_ptr=0;                     /* Can't use rnext */
48
 
  DBUG_RETURN(0);
 
46
  return(0);
49
47
} /* heap_rrnd */
50
48
 
51
49
 
59
57
           HA_ERR_END_OF_FILE = EOF.
60
58
*/
61
59
 
62
 
int heap_rrnd_old(register HP_INFO *info, uchar *record, ulong pos)
 
60
int heap_rrnd_old(register HP_INFO *info, unsigned char *record, uint32_t pos)
63
61
{
64
62
  HP_SHARE *share=info->s;
65
 
  DBUG_ENTER("heap_rrnd");
66
 
  DBUG_PRINT("enter",("info: 0x%lx  pos: %ld",info,pos));
67
 
 
 
63
asdfasdf;
68
64
  info->lastinx= -1;
69
 
  if (pos == (ulong) -1)
 
65
  if (pos == (uint32_t) -1)
70
66
  {
71
67
    pos= ++info->current_record;
72
68
    if (pos % share->block.records_in_block &&  /* Quick next record */
73
 
        pos < share->records+share->deleted &&
74
 
        (info->update & HA_STATE_PREV_FOUND))
 
69
      pos < share->used_chunk_count+share->deleted_chunk_count &&
 
70
            (info->update & HA_STATE_PREV_FOUND))
75
71
    {
76
 
      info->current_ptr+=share->block.recbuffer;
 
72
      info->current_ptr+=share->block.recbufferlen;
77
73
      goto end;
78
74
    }
79
75
  }
80
76
  else
81
77
    info->current_record=pos;
82
78
 
83
 
  if (pos >= share->records+share->deleted)
 
79
  if (pos >= share->used_chunk_count+share->deleted_chunk_count)
84
80
  {
85
81
    info->update= 0;
86
 
    DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE);
 
82
    return(my_errno= HA_ERR_END_OF_FILE);
87
83
  }
88
84
 
89
85
        /* Find record number pos */
93
89
  if (!info->current_ptr[share->reclength])
94
90
  {
95
91
    info->update= HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND;
96
 
    DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED);
 
92
    return(my_errno=HA_ERR_RECORD_DELETED);
97
93
  }
98
94
  info->update=HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV;
99
95
  memcpy(record,info->current_ptr,(size_t) share->reclength);
100
 
  DBUG_PRINT("exit",("found record at 0x%lx",info->current_ptr));
101
96
  info->current_hash_ptr=0;                     /* Can't use rnext */
102
 
  DBUG_RETURN(0);
 
97
  return(0);
103
98
} /* heap_rrnd */
104
99
 
105
100
#endif /* WANT_OLD_HEAP_VERSION */