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.

136 lines
3.9 KiB

  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. #if defined(_DLL) && !defined(_MT)
  13. #error Cannot define _DLL without _MT
  14. #endif
  15. #ifdef _MT
  16. #define _FAR_ _far
  17. #else
  18. #define _FAR_
  19. #endif
  20. /* constants for based heap routines */
  21. #if (_MSC_VER >= 600)
  22. #define _NULLSEG ((_segment)0)
  23. #define _NULLOFF ((void _based(void) *)0xffff)
  24. #endif
  25. /* constants for _heapchk/_heapset/_heapwalk routines */
  26. #define _HEAPEMPTY (-1)
  27. #define _HEAPOK (-2)
  28. #define _HEAPBADBEGIN (-3)
  29. #define _HEAPBADNODE (-4)
  30. #define _HEAPEND (-5)
  31. #define _HEAPBADPTR (-6)
  32. #define _FREEENTRY 0
  33. #define _USEDENTRY 1
  34. /* maximum heap request that can ever be honored */
  35. #define _HEAP_MAXREQ 0xFFE8
  36. /* types and structures */
  37. #ifndef _SIZE_T_DEFINED
  38. typedef unsigned int size_t;
  39. #define _SIZE_T_DEFINED
  40. #endif
  41. #ifndef _HEAPINFO_DEFINED
  42. typedef struct _heapinfo {
  43. int _far * _pentry;
  44. size_t _size;
  45. int _useflag;
  46. } _HEAPINFO;
  47. #define _HEAPINFO_DEFINED
  48. #endif
  49. /* external variable declarations */
  50. #ifdef _DLL
  51. extern unsigned int _FAR_ _cdecl _amblksiz;
  52. #else
  53. extern unsigned int _near _cdecl _amblksiz;
  54. #endif
  55. /* based heap function prototypes */
  56. #if (_MSC_VER >= 600)
  57. void _based(void) * _FAR_ _cdecl _bcalloc(_segment, size_t, size_t);
  58. void _based(void) * _FAR_ _cdecl _bexpand(_segment,
  59. void _based(void) *, size_t);
  60. void _FAR_ _cdecl _bfree(_segment, void _based(void) *);
  61. int _FAR_ _cdecl _bfreeseg(_segment);
  62. int _FAR_ _cdecl _bheapadd(_segment, void _based(void) *, size_t);
  63. int _FAR_ _cdecl _bheapchk(_segment);
  64. int _FAR_ _cdecl _bheapmin(_segment);
  65. _segment _FAR_ _cdecl _bheapseg(size_t);
  66. int _FAR_ _cdecl _bheapset(_segment, unsigned int);
  67. int _FAR_ _cdecl _bheapwalk(_segment, _HEAPINFO *);
  68. void _based(void) * _FAR_ _cdecl _bmalloc(_segment, size_t);
  69. size_t _FAR_ _cdecl _bmsize(_segment, void _based(void) *);
  70. void _based(void) * _FAR_ _cdecl _brealloc(_segment,
  71. void _based(void) *, size_t);
  72. #endif
  73. /* function prototypes */
  74. void _FAR_ * _FAR_ _cdecl alloca(size_t);
  75. void _FAR_ * _FAR_ _cdecl calloc(size_t, size_t);
  76. void _FAR_ * _FAR_ _cdecl _expand(void _FAR_ *, size_t);
  77. void _far * _FAR_ _cdecl _fcalloc(size_t, size_t);
  78. void _far * _FAR_ _cdecl _fexpand(void _far *, size_t);
  79. void _FAR_ _cdecl _ffree(void _far *);
  80. int _FAR_ _cdecl _fheapchk(void);
  81. int _FAR_ _cdecl _fheapmin(void);
  82. int _FAR_ _cdecl _fheapset(unsigned int);
  83. int _FAR_ _cdecl _fheapwalk(_HEAPINFO _FAR_ *);
  84. void _far * _FAR_ _cdecl _fmalloc(size_t);
  85. size_t _FAR_ _cdecl _fmsize(void _far *);
  86. void _far * _FAR_ _cdecl _frealloc(void _far *, size_t);
  87. unsigned int _FAR_ _cdecl _freect(size_t);
  88. void _FAR_ _cdecl free(void _FAR_ *);
  89. void _huge * _FAR_ _cdecl halloc(long, size_t);
  90. void _FAR_ _cdecl hfree(void _huge *);
  91. int _FAR_ _cdecl _heapadd(void _far *, size_t);
  92. int _FAR_ _cdecl _heapchk(void);
  93. int _FAR_ _cdecl _heapmin(void);
  94. int _FAR_ _cdecl _heapset(unsigned int);
  95. int _FAR_ _cdecl _heapwalk(_HEAPINFO _FAR_ *);
  96. void _FAR_ * _FAR_ _cdecl malloc(size_t);
  97. size_t _FAR_ _cdecl _memavl(void);
  98. size_t _FAR_ _cdecl _memmax(void);
  99. size_t _FAR_ _cdecl _msize(void _FAR_ *);
  100. void _near * _FAR_ _cdecl _ncalloc(size_t, size_t);
  101. void _near * _FAR_ _cdecl _nexpand(void _near *, size_t);
  102. void _FAR_ _cdecl _nfree(void _near *);
  103. int _FAR_ _cdecl _nheapchk(void);
  104. int _FAR_ _cdecl _nheapmin(void);
  105. int _FAR_ _cdecl _nheapset(unsigned int);
  106. int _FAR_ _cdecl _nheapwalk(_HEAPINFO _FAR_ *);
  107. void _near * _FAR_ _cdecl _nmalloc(size_t);
  108. size_t _FAR_ _cdecl _nmsize(void _near *);
  109. void _near * _FAR_ _cdecl _nrealloc(void _near *, size_t);
  110. void _FAR_ * _FAR_ _cdecl realloc(void _FAR_ *, size_t);
  111. size_t _FAR_ _cdecl stackavail(void);