Leaked source code of windows server 2003
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.

155 lines
4.1 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. void * __cdecl _alloca(size_t);
  75. void * __cdecl calloc(size_t, size_t);
  76. void * __cdecl _expand(void *, size_t);
  77. void __far * __cdecl _fcalloc(size_t, size_t);
  78. void __far * __cdecl _fexpand(void __far *, size_t);
  79. void __cdecl _ffree(void __far *);
  80. int __cdecl _fheapchk(void);
  81. int __cdecl _fheapmin(void);
  82. int __cdecl _fheapset(unsigned int);
  83. int __cdecl _fheapwalk(_HEAPINFO *);
  84. void __far * __cdecl _fmalloc(size_t);
  85. size_t __cdecl _fmsize(void __far *);
  86. void __far * __cdecl _frealloc(void __far *, size_t);
  87. unsigned int __cdecl _freect(size_t);
  88. void __cdecl free(void *);
  89. void __huge * __cdecl _halloc(long, size_t);
  90. void __cdecl _hfree(void __huge *);
  91. #ifndef _WINDOWS
  92. int __cdecl _heapadd(void __far *, size_t);
  93. int __cdecl _heapchk(void);
  94. #endif
  95. int __cdecl _heapmin(void);
  96. #ifndef _WINDOWS
  97. int __cdecl _heapset(unsigned int);
  98. int __cdecl _heapwalk(_HEAPINFO *);
  99. #endif
  100. void * __cdecl malloc(size_t);
  101. size_t __cdecl _memavl(void);
  102. size_t __cdecl _memmax(void);
  103. size_t __cdecl _msize(void *);
  104. void __near * __cdecl _ncalloc(size_t, size_t);
  105. void __near * __cdecl _nexpand(void __near *, size_t);
  106. void __cdecl _nfree(void __near *);
  107. #ifndef _WINDOWS
  108. int __cdecl _nheapchk(void);
  109. #endif
  110. int __cdecl _nheapmin(void);
  111. #ifndef _WINDOWS
  112. int __cdecl _nheapset(unsigned int);
  113. int __cdecl _nheapwalk(_HEAPINFO *);
  114. #endif
  115. void __near * __cdecl _nmalloc(size_t);
  116. size_t __cdecl _nmsize(void __near *);
  117. void __near * __cdecl _nrealloc(void __near *, size_t);
  118. void * __cdecl realloc(void *, size_t);
  119. size_t __cdecl _stackavail(void);
  120. #ifndef __STDC__
  121. /* Non-ANSI names for compatibility */
  122. void * __cdecl alloca(size_t);
  123. void __huge * __cdecl halloc(long, size_t);
  124. void __cdecl hfree(void __huge *);
  125. size_t __cdecl stackavail(void);
  126. #endif
  127. #ifdef __cplusplus
  128. }
  129. #endif
  130. #define _INC_MALLOC
  131. #endif