home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c040 / 6.ddi / INCLUDE / MALLOC.H$ / MALLOC.bin
Encoding:
Text File  |  1989-10-04  |  3.9 KB  |  137 lines

  1. /***
  2. *malloc.h - declarations and definitions for memory allocation functions
  3. *
  4. *    Copyright (c) 1985-1990, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    Contains the function declarations for memory allocation functions;
  8. *    also defines manifest constants and types used by the heap routines.
  9. *    [System V]
  10. *
  11. ****/
  12.  
  13. #if defined(_DLL) && !defined(_MT)
  14. #error Cannot define _DLL without _MT
  15. #endif
  16.  
  17. #ifdef _MT
  18. #define _FAR_ _far
  19. #else
  20. #define _FAR_
  21. #endif
  22.  
  23.  
  24. /* constants for based heap routines */
  25.  
  26. #if (_MSC_VER >= 600)
  27. #define _NULLSEG    ((_segment)0)
  28. #define _NULLOFF    ((void _based(void) *)0xffff)
  29. #endif
  30.  
  31.  
  32. /* constants for _heapchk/_heapset/_heapwalk routines */
  33.  
  34. #define _HEAPEMPTY    (-1)
  35. #define _HEAPOK     (-2)
  36. #define _HEAPBADBEGIN    (-3)
  37. #define _HEAPBADNODE    (-4)
  38. #define _HEAPEND    (-5)
  39. #define _HEAPBADPTR    (-6)
  40. #define _FREEENTRY    0
  41. #define _USEDENTRY    1
  42.  
  43.  
  44. /* maximum heap request that can ever be honored */
  45.  
  46. #define _HEAP_MAXREQ    0xFFE8
  47.  
  48.  
  49. /* types and structures */
  50.  
  51. #ifndef _SIZE_T_DEFINED
  52. typedef unsigned int size_t;
  53. #define _SIZE_T_DEFINED
  54. #endif
  55.  
  56.  
  57. #ifndef _HEAPINFO_DEFINED
  58. typedef struct _heapinfo {
  59.     int _far * _pentry;
  60.     size_t _size;
  61.     int _useflag;
  62.     } _HEAPINFO;
  63. #define _HEAPINFO_DEFINED
  64. #endif
  65.  
  66.  
  67. /* external variable declarations */
  68.  
  69. #ifdef _DLL
  70. extern unsigned int _FAR_ _cdecl _amblksiz;
  71. #else
  72. extern unsigned int _near _cdecl _amblksiz;
  73. #endif
  74.  
  75.  
  76. /* based heap function prototypes */
  77.  
  78. #if (_MSC_VER >= 600)
  79. void _based(void) * _FAR_ _cdecl _bcalloc(_segment, size_t, size_t);
  80. void _based(void) * _FAR_ _cdecl _bexpand(_segment,
  81.     void _based(void) *, size_t);
  82. void _FAR_ _cdecl _bfree(_segment, void _based(void) *);
  83. int _FAR_ _cdecl _bfreeseg(_segment);
  84. int _FAR_ _cdecl _bheapadd(_segment, void _based(void) *, size_t);
  85. int _FAR_ _cdecl _bheapchk(_segment);
  86. int _FAR_ _cdecl _bheapmin(_segment);
  87. _segment _FAR_ _cdecl _bheapseg(size_t);
  88. int _FAR_ _cdecl _bheapset(_segment, unsigned int);
  89. int _FAR_ _cdecl _bheapwalk(_segment, _HEAPINFO *);
  90. void _based(void) * _FAR_ _cdecl _bmalloc(_segment, size_t);
  91. size_t _FAR_ _cdecl _bmsize(_segment, void _based(void) *);
  92. void _based(void) * _FAR_ _cdecl _brealloc(_segment,
  93.     void _based(void) *, size_t);
  94. #endif
  95.  
  96.  
  97. /* function prototypes */
  98.  
  99. void _FAR_ * _FAR_ _cdecl alloca(size_t);
  100. void _FAR_ * _FAR_ _cdecl calloc(size_t, size_t);
  101. void _FAR_ * _FAR_ _cdecl _expand(void _FAR_ *, size_t);
  102. void _far * _FAR_ _cdecl _fcalloc(size_t, size_t);
  103. void _far * _FAR_ _cdecl _fexpand(void _far *, size_t);
  104. void _FAR_ _cdecl _ffree(void _far *);
  105. int _FAR_ _cdecl _fheapchk(void);
  106. int _FAR_ _cdecl _fheapmin(void);
  107. int _FAR_ _cdecl _fheapset(unsigned int);
  108. int _FAR_ _cdecl _fheapwalk(_HEAPINFO _FAR_ *);
  109. void _far * _FAR_ _cdecl _fmalloc(size_t);
  110. size_t _FAR_ _cdecl _fmsize(void _far *);
  111. void _far * _FAR_ _cdecl _frealloc(void _far *, size_t);
  112. unsigned int _FAR_ _cdecl _freect(size_t);
  113. void _FAR_ _cdecl free(void _FAR_ *);
  114. void _huge * _FAR_ _cdecl halloc(long, size_t);
  115. void _FAR_ _cdecl hfree(void _huge *);
  116. int _FAR_ _cdecl _heapadd(void _far *, size_t);
  117. int _FAR_ _cdecl _heapchk(void);
  118. int _FAR_ _cdecl _heapmin(void);
  119. int _FAR_ _cdecl _heapset(unsigned int);
  120. int _FAR_ _cdecl _heapwalk(_HEAPINFO _FAR_ *);
  121. void _FAR_ * _FAR_ _cdecl malloc(size_t);
  122. size_t _FAR_ _cdecl _memavl(void);
  123. size_t _FAR_ _cdecl _memmax(void);
  124. size_t _FAR_ _cdecl _msize(void _FAR_ *);
  125. void _near * _FAR_ _cdecl _ncalloc(size_t, size_t);
  126. void _near * _FAR_ _cdecl _nexpand(void _near *, size_t);
  127. void _FAR_ _cdecl _nfree(void _near *);
  128. int _FAR_ _cdecl _nheapchk(void);
  129. int _FAR_ _cdecl _nheapmin(void);
  130. int _FAR_ _cdecl _nheapset(unsigned int);
  131. int _FAR_ _cdecl _nheapwalk(_HEAPINFO _FAR_ *);
  132. void _near * _FAR_ _cdecl _nmalloc(size_t);
  133. size_t _FAR_ _cdecl _nmsize(void _near *);
  134. void _near * _FAR_ _cdecl _nrealloc(void _near *, size_t);
  135. void _FAR_ * _FAR_ _cdecl realloc(void _FAR_ *, size_t);
  136. size_t _FAR_ _cdecl stackavail(void);
  137.