~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/thr_malloc.cc

  • Committer: Brian Aker
  • Date: 2009-04-27 14:36:40 UTC
  • Revision ID: brian@gaz-20090427143640-f6zjmtt9vm55qgm2
Patch on show processlist from  davi@apache.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
/* Mallocs for used in threads */
18
18
 
19
19
#include <drizzled/server_includes.h>
20
 
#include <drizzled/drizzled_error_messages.h>
 
20
#include <drizzled/current_session.h>
 
21
#include <drizzled/error.h>
21
22
 
22
23
extern "C" {
23
24
  void sql_alloc_error_handler(void)
24
25
  {
25
 
    sql_print_error(ER(ER_OUT_OF_RESOURCES));
 
26
    errmsg_printf(ERRMSG_LVL_ERROR, "%s",ER(ER_OUT_OF_RESOURCES));
26
27
  }
27
28
}
28
29
 
29
 
void init_sql_alloc(MEM_ROOT *mem_root, uint32_t block_size, uint32_t pre_alloc)
 
30
void init_sql_alloc(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc)
30
31
{
31
32
  init_alloc_root(mem_root, block_size, pre_alloc);
32
 
  mem_root->error_handler=sql_alloc_error_handler;
 
33
  mem_root->error_handler= sql_alloc_error_handler;
33
34
}
34
35
 
35
36
 
36
37
void *sql_alloc(size_t Size)
37
38
{
38
 
  MEM_ROOT *root= *(MEM_ROOT **)pthread_getspecific(THR_MALLOC);
 
39
  MEM_ROOT *root= current_mem_root();
39
40
  return alloc_root(root,Size);
40
41
}
41
42
 
79
80
  return pos;
80
81
}
81
82
 
82
 
void sql_element_free(void *ptr __attribute__((unused)))
83
 
{} /* purecov: deadcode */
84
 
 
85
 
 
86
 
 
87
83
char *sql_strmake_with_convert(const char *str, size_t arg_length,
88
 
                               const CHARSET_INFO * const from_cs,
89
 
                               size_t max_res_length,
90
 
                               const CHARSET_INFO * const to_cs, size_t *result_length)
 
84
                               const CHARSET_INFO * const from_cs,
 
85
                               size_t max_res_length,
 
86
                               const CHARSET_INFO * const to_cs,
 
87
                               size_t *result_length)
91
88
{
92
89
  char *pos;
93
90
  size_t new_length= to_cs->mbmaxlen*arg_length;