1 2 /******************************************** 3 zmalloc.h 4 copyright 1991, Michael D. Brennan 5 6 This is a source file for mawk, an implementation of 7 the AWK programming language. 8 9 Mawk is distributed without warranty under the terms of 10 the GNU General Public License, version 2, 1991. 11 ********************************************/ 12 13 /*$Log: zmalloc.h,v $ 14 * Revision 5.1 1991/12/05 07:59:41 brennan 15 * 1.1 pre-release 16 * 17 */ 18 19 /* zmalloc.h */ 20 21 #ifndef ZMALLOC_H 22 #define ZMALLOC_H 23 24 #if ! HAVE_STDLIB_H 25 char *malloc() , *realloc() ; 26 void free() ; 27 #endif 28 29 30 PTR PROTO( bmalloc, (unsigned) ) ; 31 void PROTO( bfree, (PTR, unsigned) ) ; 32 PTR PROTO( zrealloc , (PTR,unsigned,unsigned) ) ; 33 34 35 #define ZBLOCKSZ 8 36 #define ZSHIFT 3 37 38 39 #define zmalloc(size) bmalloc((((unsigned)size)+ZBLOCKSZ-1)>>ZSHIFT) 40 #define zfree(p,size) bfree(p,(((unsigned)size)+ZBLOCKSZ-1)>>ZSHIFT) 41 42 #define ZMALLOC(type) ((type*)zmalloc(sizeof(type))) 43 #define ZFREE(p) zfree(p,sizeof(*(p))) 44 45 46 #endif /* ZMALLOC_H */ 47