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.

154 lines
2.9 KiB

  1. /***
  2. *malloc.h - declarations and definitions for memory allocation functions
  3. *
  4. * Copyright (c) 1985-1994, 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. #define _INC_MALLOC
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  18. #ifndef _CRTAPI1
  19. #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
  20. #define _CRTAPI1 __cdecl
  21. #else
  22. #define _CRTAPI1
  23. #endif
  24. #endif
  25. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  26. #ifndef _CRTAPI2
  27. #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
  28. #define _CRTAPI2 __cdecl
  29. #else
  30. #define _CRTAPI2
  31. #endif
  32. #endif
  33. /* Define _CRTIMP */
  34. #ifndef _CRTIMP
  35. #ifdef _NTSDK
  36. /* definition compatible with NT SDK */
  37. #define _CRTIMP
  38. #else /* ndef _NTSDK */
  39. /* current definition */
  40. #ifdef _DLL
  41. #define _CRTIMP __declspec(dllimport)
  42. #else /* ndef _DLL */
  43. #define _CRTIMP
  44. #endif /* _DLL */
  45. #endif /* _NTSDK */
  46. #endif /* _CRTIMP */
  47. /* Define __cdecl for non-Microsoft compilers */
  48. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  49. #define __cdecl
  50. #endif
  51. #ifndef _SIZE_T_DEFINED
  52. typedef unsigned int size_t;
  53. #define _SIZE_T_DEFINED
  54. #endif
  55. #ifndef _NTSDK
  56. /* Maximum heap request the heap manager will attempt */
  57. #define _HEAP_MAXREQ 0xFFFFD000
  58. /* Constants for _heapchk/_heapset/_heapwalk routines */
  59. #define _HEAPEMPTY (-1)
  60. #define _HEAPOK (-2)
  61. #define _HEAPBADBEGIN (-3)
  62. #define _HEAPBADNODE (-4)
  63. #define _HEAPEND (-5)
  64. #define _HEAPBADPTR (-6)
  65. #define _FREEENTRY 0
  66. #define _USEDENTRY 1
  67. #ifndef _HEAPINFO_DEFINED
  68. typedef struct _heapinfo {
  69. int * _pentry;
  70. size_t _size;
  71. int _useflag;
  72. } _HEAPINFO;
  73. #define _HEAPINFO_DEFINED
  74. #endif
  75. /* External variable declarations */
  76. #if defined(_DLL) && defined(_M_IX86)
  77. #define _amblksiz (*__p__amblksiz())
  78. _CRTIMP unsigned int * __cdecl __p__amblksiz(void);
  79. #else /* !(defined(_DLL) && defined(_M_IX86)) */
  80. extern unsigned int _amblksiz;
  81. #endif /* defined(_DLL) && defined(_M_IX86) */
  82. #endif /* _NTSDK */
  83. /* Function prototypes */
  84. _CRTIMP void * __cdecl calloc(size_t, size_t);
  85. _CRTIMP void __cdecl free(void *);
  86. _CRTIMP void * __cdecl malloc(size_t);
  87. _CRTIMP void * __cdecl realloc(void *, size_t);
  88. #ifndef _POSIX_
  89. void * __cdecl _alloca(size_t);
  90. _CRTIMP void * __cdecl _expand(void *, size_t);
  91. #ifndef _NTSDK
  92. _CRTIMP int __cdecl _heapadd(void *, size_t);
  93. _CRTIMP int __cdecl _heapchk(void);
  94. _CRTIMP int __cdecl _heapmin(void);
  95. _CRTIMP int __cdecl _heapset(unsigned int);
  96. _CRTIMP int __cdecl _heapwalk(_HEAPINFO *);
  97. _CRTIMP size_t __cdecl _heapused(size_t *, size_t *);
  98. #endif /* _NTSDK */
  99. _CRTIMP size_t __cdecl _msize(void *);
  100. #if !__STDC__
  101. /* Non-ANSI names for compatibility */
  102. #define alloca _alloca
  103. #endif /* __STDC__*/
  104. #ifdef _M_MRX000
  105. #pragma intrinsic(_alloca)
  106. #endif
  107. #endif /* _POSIX_ */
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111. #endif /* _INC_MALLOC */