drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
sql_alloc.cc
1/* Copyright (C) 2000-2001, 2003-2004 MySQL AB
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
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 */
15
16
17/* Mallocs for used in threads */
18
19#include <config.h>
20
21#include <string.h>
22
23#include <drizzled/errmsg_print.h>
24#include <drizzled/memory/sql_alloc.h>
25#include <drizzled/current_session.h>
26#include <drizzled/error.h>
28#include <drizzled/internal/my_sys.h>
29
30namespace drizzled {
31namespace memory {
32
33void* sql_alloc(size_t Size)
34{
35 return current_mem_root()->alloc(Size);
36}
37
38void* sql_calloc(size_t size)
39{
40 return current_mem_root()->calloc(size);
41}
42
43char* sql_strdup(const char* str)
44{
45 return current_mem_root()->strdup(str);
46}
47
48char* sql_strdup(str_ref str)
49{
50 return current_mem_root()->strdup(str);
51}
52
53void* sql_memdup(const void* ptr, size_t len)
54{
55 return current_mem_root()->memdup(ptr, len);
56}
57
58}
59} /* namespace drizzled */
unsigned char * alloc(size_t Size)
Allocate a chunk of memory from the Root structure provided, obtaining more memory from the heap if n...
Definition root.cc:140
void * memdup(const void *, size_t)
Duplicate the provided block into memory allocated from within the specified Root.
Definition root.cc:365
char * strdup(const char *)
Duplicate a null-terminated string into memory allocated from within the specified Root.
Definition root.cc:327
TODO: Rename this file - func.h is stupid.