My Project
sql_alloc.h
00001 #ifndef SQL_ALLOC_INCLUDED
00002 #define SQL_ALLOC_INCLUDED
00003 /* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; version 2 of the License.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; if not, write to the Free Software Foundation,
00016    51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
00017 
00018 #include "thr_malloc.h"
00019 #include "my_sys.h"
00020 #include "m_string.h"
00021 
00026 class Sql_alloc
00027 {
00028 public:
00029   static void *operator new(size_t size) throw ()
00030   {
00031     return sql_alloc(size);
00032   }
00033   static void *operator new[](size_t size) throw ()
00034   {
00035     return sql_alloc(size);
00036   }
00037   static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
00038   { return alloc_root(mem_root, size); }
00039   static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
00040   { return alloc_root(mem_root, size); }
00041   static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
00042   static void operator delete(void *ptr, MEM_ROOT *mem_root)
00043   { /* never called */ }
00044   static void operator delete[](void *ptr, MEM_ROOT *mem_root)
00045   { /* never called */ }
00046   static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
00047 #ifdef HAVE_purify
00048   bool dummy;
00049   inline Sql_alloc() :dummy(0) {}
00050   inline ~Sql_alloc() {}
00051 #else
00052   inline Sql_alloc() {}
00053   inline ~Sql_alloc() {}
00054 #endif
00055 
00056 };
00057 
00058 #endif // SQL_ALLOC_INCLUDED
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines