~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/sql_alloc.cc

Merge Stewart.

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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
 
17
17
/* Mallocs for used in threads */
33
33
 
34
34
static void sql_alloc_error_handler(void)
35
35
{
36
 
  errmsg_printf(error::ERROR, "%s",ER(ER_OUT_OF_RESOURCES));
 
36
  errmsg_printf(ERRMSG_LVL_ERROR, "%s",ER(ER_OUT_OF_RESOURCES));
37
37
}
38
38
 
39
39
void memory::init_sql_alloc(memory::Root *mem_root, size_t block_size, size_t)
40
40
{
41
 
  mem_root->init_alloc_root(block_size);
 
41
  memory::init_alloc_root(mem_root, block_size);
42
42
  mem_root->error_handler= sql_alloc_error_handler;
43
43
}
44
44
 
46
46
void *memory::sql_alloc(size_t Size)
47
47
{
48
48
  memory::Root *root= current_mem_root();
49
 
  return root->alloc_root(Size);
 
49
  return memory::alloc_root(root,Size);
50
50
}
51
51
 
52
52
 
53
53
void *memory::sql_calloc(size_t size)
54
54
{
55
55
  void *ptr;
56
 
 
57
56
  if ((ptr=memory::sql_alloc(size)))
58
57
    memset(ptr, 0, size);
59
 
 
60
58
  return ptr;
61
59
}
62
60
 
103
101
 
104
102
void *memory::SqlAlloc::operator new[](size_t size, memory::Root *mem_root)
105
103
{
106
 
  return mem_root->alloc_root(size);
 
104
  return memory::alloc_root(mem_root, size);
107
105
}
108
106
 
109
107
void *memory::SqlAlloc::operator new(size_t size, memory::Root *mem_root)
110
108
{
111
 
  return mem_root->alloc_root(size);
 
109
  return memory::alloc_root(mem_root, size);
112
110
}
113
111
 
114
112
} /* namespace drizzled */