|
Blender
V2.59
|
00001 /* 00002 * $Id: mallocn.cpp 35153 2011-02-25 11:41:12Z jesterking $ 00003 * ***** BEGIN GPL LICENSE BLOCK ***** 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software Foundation, 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 * Contributor(s): Campbell Barton 00020 * 00021 * ***** END GPL LICENSE BLOCK ***** 00022 */ 00023 00029 #include <new> 00030 #include "../MEM_guardedalloc.h" 00031 00032 void* operator new (size_t size) 00033 { 00034 return MEM_mallocN(size, "C++/anonymous"); 00035 } 00036 00037 /* not default but can be used when needing to set a string */ 00038 void* operator new (size_t size, const char *str) 00039 { 00040 return MEM_mallocN(size, str); 00041 } 00042 00043 void operator delete (void *p) 00044 { 00045 MEM_freeN(p); 00046 }