Initial commit, includes Lua with broken Luabind as a backup for branching purposes
[terrastrategy.git] / include / mem_on.h
blobc07376f997566fdc159f0c71c62cc8926725d9d5
1 //
2 // Copyright (C) 2008 by Martin Moracek
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // ----------------------------------------------------------------------------
20 // Originally created on 12/22/2000 by Paul Nettle
22 // Copyright 2000, Fluid Studios, Inc., all rights reserved.
24 // For more information, visit HTTP://www.FluidStudios.com
25 // ----------------------------------------------------------------------------
27 /**
28 * @file mem_on.h
30 * Contains macros overriding the standard new/delete operators.
33 // defines MEM_MANAGER_ON macro
34 #include "config.h"
36 #ifdef MEM_MANAGER_ON
38 #define new (tre::SetOwner(__FILE__,__LINE__,__FUNCTION__),false) ? NULL : new
39 #define delete (tre::SetOwner(__FILE__,__LINE__,__FUNCTION__),false) ? \
40 tre::SetOwner("",0,"") : delete
41 #define malloc(sz) tre::Allocator(__FILE__,__LINE__,\
42 __FUNCTION__,tre::atMalloc,sz)
43 #define calloc(sz) tre::Allocator(__FILE__,__LINE__,\
44 __FUNCTION__,tre::atCalloc,sz)
45 #define realloc(ptr,sz) tre::Reallocator(__FILE__,__LINE__,\
46 __FUNCTION__,tre::atRealloc,sz,ptr)
47 #define free(ptr) tre::Deallocator(__FILE__,__LINE__,\
48 __FUNCTION__,tre::atFree,ptr)
50 #endif /* MEM_MANAGER_ON */