home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 11 / AUCD11B.iso / LANGUAGES / WraithSet / AwkStuff / MawkSrc / h / zmalloc < prev   
Text File  |  1993-07-04  |  1KB  |  49 lines

  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 1.2  1993/07/04  12:52:22  mike
  15.  * start on autoconfig changes
  16.  *
  17.  * Revision 1.1.1.1  1993/07/03  18:58:23  mike
  18.  * move source to cvs
  19.  *
  20.  * Revision 5.1  1991/12/05  07:59:41  brennan
  21.  * 1.1 pre-release
  22.  *
  23. */
  24.  
  25. /* zmalloc.h */
  26.  
  27. #ifndef  ZMALLOC_H
  28. #define  ZMALLOC_H
  29.  
  30. #include "nstd.h"
  31.  
  32. PTR  PROTO( bmalloc, (unsigned) ) ;
  33. void PROTO( bfree, (PTR, unsigned) ) ;
  34. PTR  PROTO( zrealloc , (PTR,unsigned,unsigned) ) ;
  35.  
  36.  
  37. #define ZBLOCKSZ    8    
  38. #define ZSHIFT      3
  39.  
  40.  
  41. #define zmalloc(size)  bmalloc((((unsigned)size)+ZBLOCKSZ-1)>>ZSHIFT)
  42. #define zfree(p,size)  bfree(p,(((unsigned)size)+ZBLOCKSZ-1)>>ZSHIFT)
  43.  
  44. #define ZMALLOC(type)  ((type*)zmalloc(sizeof(type)))
  45. #define ZFREE(p)    zfree(p,sizeof(*(p)))
  46.  
  47.  
  48. #endif  /* ZMALLOC_H */
  49.