Drizzled Public API Documentation

sql_alloc.cc
00001 /* Copyright (C) 2000-2001, 2003-2004 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 
00017 /* Mallocs for used in threads */
00018 
00019 #include <config.h>
00020 
00021 #include <string.h>
00022 
00023 #include <drizzled/errmsg_print.h>
00024 #include <drizzled/memory/sql_alloc.h>
00025 #include <drizzled/current_session.h>
00026 #include <drizzled/error.h>
00027 #include <drizzled/definitions.h>
00028 #include <drizzled/internal/my_sys.h>
00029 
00030 namespace drizzled {
00031 namespace memory {
00032 
00033 void* sql_alloc(size_t Size)
00034 {
00035   return current_mem_root()->alloc(Size);
00036 }
00037 
00038 void* sql_calloc(size_t size)
00039 {
00040   return current_mem_root()->calloc(size);
00041 }
00042 
00043 char* sql_strdup(const char* str)
00044 {
00045   return current_mem_root()->strdup(str);
00046 }
00047 
00048 char* sql_strdup(str_ref str)
00049 {
00050   return current_mem_root()->strdup(str);
00051 }
00052 
00053 void* sql_memdup(const void* ptr, size_t len)
00054 {
00055   return current_mem_root()->memdup(ptr, len);
00056 }
00057 
00058 }
00059 } /* namespace drizzled */