|
Odamex
Setting the Standard in Multiplayer Doom
|
00001 // Emacs style mode select -*- C++ -*- 00002 //----------------------------------------------------------------------------- 00003 // 00004 // $Id: m_alloc.h 2046 2011-01-14 22:06:13Z russellrice $ 00005 // 00006 // Copyright (C) 1998-2006 by Randy Heit (ZDoom). 00007 // Copyright (C) 2006-2010 by The Odamex Team. 00008 // 00009 // This program is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU General Public License 00011 // as published by the Free Software Foundation; either version 2 00012 // of the License, or (at your option) any later version. 00013 // 00014 // This program is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // DESCRIPTION: 00020 // Wrappers around the standard memory allocation routines. 00021 // 00022 //----------------------------------------------------------------------------- 00023 00024 00025 #ifndef __M_ALLOC_H__ 00026 #define __M_ALLOC_H__ 00027 00028 #include <stdlib.h> 00029 00030 // don't use these, use the macros below instead! 00031 void *Malloc (size_t size); 00032 void *Calloc (size_t num, size_t size); 00033 void *Realloc (void *memblock, size_t size); 00034 void M_Free2 (void **memblock); 00035 00036 #define M_Malloc(s) Malloc((size_t)s) 00037 #define M_Calloc(n,s) Calloc((size_t)n, (size_t)s) 00038 #define M_Realloc(p,s) Realloc((void *)p, (size_t)s) 00039 00040 #define M_Free(p) \ 00041 if (1) \ 00042 M_Free2((void **)&p); \ 00043 else \ 00044 (void)0 00045 00046 #endif //__M_ALLOC_H__ 00047 00048