~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/thr_malloc.cc

Cleanup around SAFEMALLOC

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
extern "C" {
23
23
  void sql_alloc_error_handler(void)
24
24
  {
25
 
    sql_print_error("%s",ER(ER_OUT_OF_RESOURCES));
 
25
    sql_print_error(ER(ER_OUT_OF_RESOURCES));
26
26
  }
27
27
}
28
28
 
29
 
void init_sql_alloc(MEM_ROOT *mem_root, uint32_t block_size, uint32_t pre_alloc)
 
29
void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc)
30
30
{
31
31
  init_alloc_root(mem_root, block_size, pre_alloc);
32
32
  mem_root->error_handler=sql_alloc_error_handler;
100
100
  if ((from_cs == &my_charset_bin) || (to_cs == &my_charset_bin))
101
101
  {
102
102
    // Safety if to_cs->mbmaxlen > 0
103
 
    new_length= cmin(arg_length, max_res_length);
 
103
    new_length= min(arg_length, max_res_length);
104
104
    memcpy(pos, str, new_length);
105
105
  }
106
106
  else
107
107
  {
108
 
    uint32_t dummy_errors;
 
108
    uint dummy_errors;
109
109
    new_length= copy_and_convert((char*) pos, new_length, to_cs, str,
110
110
                                 arg_length, from_cs, &dummy_errors);
111
111
  }