home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / DMAKE38A.ZIP / ALLOC.H < prev    next >
C/C++ Source or Header  |  1992-01-23  |  2KB  |  69 lines

  1. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/alloc.h,v 1.1 1992/01/24 03:26:54 dvadura Exp $
  2. -- SYNOPSIS -- macros for allocating memory.
  3. -- 
  4. -- DESCRIPTION
  5. --    A somewhat nicer interface to malloc and calloc.
  6. --    Here we standardise the calling convention with a common macro
  7. --    interface.
  8. -- 
  9. -- AUTHOR
  10. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  11. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  12. --
  13. -- COPYRIGHT
  14. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  15. -- 
  16. --      This program is free software; you can redistribute it and/or
  17. --      modify it under the terms of the GNU General Public License
  18. --      (version 1), as published by the Free Software Foundation, and
  19. --      found in the file 'LICENSE' included with this distribution.
  20. -- 
  21. --      This program is distributed in the hope that it will be useful,
  22. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  23. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24. --      GNU General Public License for more details.
  25. -- 
  26. --      You should have received a copy of the GNU General Public License
  27. --      along with this program;  if not, write to the Free Software
  28. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  29. --
  30. -- LOG
  31. --     $Log: alloc.h,v $
  32.  * Revision 1.1  1992/01/24  03:26:54  dvadura
  33.  * dmake Version 3.8, Initial revision
  34.  *
  35. */
  36.  
  37. #ifndef ALLOC_h
  38. #define ALLOC_h
  39.  
  40. /* DO NOT CHANGE these!  These are the definitions that the make source
  41.  * uses for allocating memory.  They must be defined for make to compile
  42.  * properly.
  43.  */
  44.  
  45. /* This is the only place that we define size_t now.  This should be more
  46.  * than enough! */
  47. #if __STDC__
  48. #else
  49. #   if !defined(_TYPES_) && !defined(M_XENIX) && !defined(atarist) && !defined(_MPW) && !defined(_SIZE_T)
  50. #      if defined(MSDOS) || defined(__MSDOS__)
  51. #         undef size_t
  52.           typedef unsigned size_t;
  53. #      else
  54.           typedef long size_t;
  55. #      endif
  56. #   endif
  57. #endif
  58.  
  59. #define    usizeof(t)    (size_t)sizeof(t)
  60.  
  61. #define FREE(p)         free((char*)(p))
  62. #define MALLOC(n, t)    (t*) malloc((unsigned int)(n)*usizeof(t))
  63. #define CALLOC(n, t)    (t*) calloc((unsigned int)(n), usizeof(t))
  64.  
  65. #define TALLOC(p, n, t)    if ((p = CALLOC(n, t)) == (t*)0) {No_ram();}
  66.  
  67. #endif
  68.  
  69.