Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
4.0 KiB

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