1 /* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen 2 * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen 3 * 4 * This file is part of tingea. You can redistribute and/or modify tingea 5 * under the terms of the GNU General Public License; either version 3 of the 6 * License or (at your option) any later version. You should have received a 7 * copy of the GPL along with tingea, in the file COPYING. 8 */ 9 10 #ifndef tingea_alloc_h 11 #define tingea_alloc_h 12 13 #include <stdio.h> 14 15 /* ========================================================================= * 16 * 17 * mcxRealloc is notable, for it *frees* memory and returns a NULL pointer 18 * if the newly requested block has size 0. This must be so in order to 19 * allow routines to do their math and housekeeping. If they register the 20 * new block as having 0 bytes, then they need not and must not attempt to 21 * free it thereafter. 22 * 23 * ========================================================================= * 24 */ 25 26 27 #include "types.h" 28 29 30 void* mcxAlloc 31 ( dim size 32 , mcxOnFail ON_FAIL 33 ) ; 34 35 void* mcxRealloc 36 ( void* object 37 , dim new_size 38 , mcxOnFail ON_FAIL 39 ) ; 40 41 void mcxFree 42 ( void* object 43 ) ; 44 45 void mcxNFree 46 ( void* base 47 , dim n_elem 48 , dim elem_size 49 , void (*obRelease) (void *) 50 ) ; 51 52 void* mcxNAlloc 53 ( dim n_elem 54 , dim elem_size 55 , void* (*obInit) (void *) 56 , mcxOnFail ON_FAIL 57 ) ; 58 59 void* mcxNRealloc 60 ( void* mem 61 , dim n_elem 62 , dim n_elem_prev 63 , dim elem_size 64 , void* (*obInit) (void *) 65 , mcxOnFail ON_FAIL 66 ) ; 67 68 void mcxMemDenied 69 ( FILE* channel 70 , const char* requestee 71 , const char* unittype 72 , dim n 73 ) ; 74 75 void mcxAllocLimits 76 ( long maxchunksize 77 , long maxtimes 78 ) ; 79 80 81 #endif 82 83