~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/memory/hp_rlast.cc

Merge Revision revid:marko.makela@oracle.com-20100505101406-u4low2x26q6itck0 from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100505101406-u4low2x26q6itck0

Original Authors: Marko Mäkelä <marko.makela@oracle.com>
Original commit message:
Merge from mysql-5.1-innodb:

  ------------------------------------------------------------
  revno: 3446
  revision-id: marko.makela@oracle.com-20100505100507-6kcd2hf32hruxbv7
  parent: marko.makela@oracle.com-20100505095328-vetnl0flhmhao7p5
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Wed 2010-05-05 13:05:07 +0300
  message:
    Add Valgrind diagnostics to track down Bug #38999.
  ------------------------------------------------------------

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
 
#include "heapdef.h"
 
16
#include "heap_priv.h"
17
17
 
18
18
#include <string.h>
19
19
 
20
20
        /* Read first record with the current key */
21
21
 
 
22
using namespace drizzled;
22
23
 
23
24
int heap_rlast(HP_INFO *info, unsigned char *record, int inx)
24
25
{
25
 
  HP_SHARE *share=    info->s;
26
 
  HP_KEYDEF *keyinfo= share->keydef + inx;
27
 
 
28
26
  info->lastinx= inx;
29
 
  if (keyinfo->algorithm == HA_KEY_ALG_BTREE)
30
 
  {
31
 
    unsigned char *pos;
32
 
 
33
 
    if ((pos = tree_search_edge(&keyinfo->rb_tree, info->parents,
34
 
                                &info->last_pos, offsetof(TREE_ELEMENT, right))))
35
 
    {
36
 
      memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), 
37
 
             sizeof(unsigned char*));
38
 
      info->current_ptr = pos;
39
 
      hp_extract_record(share, record, pos);
40
 
      info->update = HA_STATE_AKTIV;
41
 
    }
42
 
    else
43
 
    {
44
 
      my_errno = HA_ERR_END_OF_FILE;
45
 
      return(my_errno);
46
 
    }
47
 
    return(0);
48
 
  }
49
 
  else
50
27
  {
51
28
    info->current_ptr=0;
52
29
    info->current_hash_ptr=0;