~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log_event.cc

  • Committer: Monty Taylor
  • Date: 2008-12-07 20:49:18 UTC
  • mto: This revision was merged to the branch mainline in revision 670.
  • Revision ID: monty@inaugust.com-20081207204918-yv28xe4delzdm3l3
Removed my_malloc related stuff from log_event and session.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1975
1975
  number_of_event_types=
1976
1976
    event_len-(LOG_EVENT_MINIMAL_HEADER_LEN+ST_COMMON_HEADER_LEN_OFFSET+1);
1977
1977
  /* If alloc fails, we'll detect it in is_valid() */
1978
 
  post_header_len= (uint8_t*) my_memdup((unsigned char*)buf+ST_COMMON_HEADER_LEN_OFFSET+1,
1979
 
                                      number_of_event_types*
1980
 
                                      sizeof(*post_header_len), MYF(0));
 
1978
  post_header_len= (uint8_t*) malloc(number_of_event_types*
 
1979
                                     sizeof(*post_header_len));
 
1980
  memcpy(post_header_len, buf+ST_COMMON_HEADER_LEN_OFFSET+1,
 
1981
         number_of_event_types* sizeof(*post_header_len));
1981
1982
  calc_server_version_split();
1982
1983
 
1983
1984
  /*
2881
2882
                          (uint) strlen(new_log_ident_arg)), flags(flags_arg)
2882
2883
{
2883
2884
  if (flags & DUP_NAME)
2884
 
    new_log_ident= my_strndup(new_log_ident_arg, ident_len, MYF(MY_WME));
 
2885
    new_log_ident= strndup(new_log_ident_arg, ident_len);
2885
2886
  return;
2886
2887
}
2887
2888
 
2902
2903
                     (header_size+post_header_len));
2903
2904
  ident_offset = post_header_len;
2904
2905
  set_if_smaller(ident_len,FN_REFLEN-1);
2905
 
  new_log_ident= my_strndup(buf + ident_offset, (uint) ident_len, MYF(MY_WME));
 
2906
  new_log_ident= strndup(buf + ident_offset, ident_len);
2906
2907
  return;
2907
2908
}
2908
2909
 
3262
3263
  uint32_t header_len= description_event->common_header_len;
3263
3264
  uint8_t load_header_len= description_event->post_header_len[LOAD_EVENT-1];
3264
3265
  uint8_t create_file_header_len= description_event->post_header_len[CREATE_FILE_EVENT-1];
3265
 
  if (!(event_buf= (char*) my_memdup(buf, len, MYF(MY_WME))) ||
 
3266
  if (!(event_buf= (const char*)malloc(len)) ||
 
3267
      memcpy((char *)event_buf, buf, len) ||
3266
3268
      copy_log_event(event_buf,len,
3267
3269
                     ((buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ?
3268
3270
                      load_header_len + header_len :
4197
4199
  if (static_cast<size_t>(m_rows_end - m_rows_cur) <= length)
4198
4200
  {
4199
4201
    size_t const block_size= 1024;
4200
 
    my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf;
4201
 
    my_ptrdiff_t const new_alloc=
 
4202
    const size_t cur_size= m_rows_cur - m_rows_buf;
 
4203
    const size_t new_alloc=
4202
4204
        block_size * ((cur_size + length + block_size - 1) / block_size);
4203
4205
 
4204
 
    unsigned char* const new_buf= (unsigned char*)my_realloc((unsigned char*)m_rows_buf, (uint) new_alloc,
4205
 
                                           MYF(MY_ALLOW_ZERO_PTR|MY_WME));
 
4206
    unsigned char* const new_buf= 
 
4207
      (m_rows_buf) ? (unsigned char*)realloc(m_rows_buf, new_alloc)
 
4208
                   : (unsigned char*)malloc(new_alloc);
4206
4209
    if (unlikely(!new_buf))
4207
4210
      return(HA_ERR_OUT_OF_MEM);
4208
4211