home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / MALLOC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  2.9 KB  |  113 lines

  1. /*  malloc.h
  2.  
  3.     memory management functions and variables.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.0
  9.  *
  10.  *      Copyright (c) 1991, 1993 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #ifndef __MALLOC_H
  16. #define __MALLOC_H
  17.  
  18. #include <alloc.h>
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24.  
  25. #if !defined(_Windows) || defined(__FLAT__)
  26. /* _HEAPINFO structure returned by heapwalk */
  27.  
  28. #pragma option -a-
  29.  
  30. typedef struct _heapinfo
  31. {
  32.     int     *_pentry;
  33.     size_t  _size;
  34.     int     _useflag;
  35. } _HEAPINFO;
  36.  
  37. #pragma option -a.
  38.  
  39. #endif  /* _Windows */
  40.  
  41.  
  42. #if !defined(__FLAT__)
  43.  
  44. #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
  45.  
  46. /* Near heap functions currently allowed only in small data models */
  47.  
  48. #define _nmalloc(size)          malloc(size)
  49. #define _nfree(block)           free(block)
  50. #define _nrealloc(block,size)   realloc(block,size)
  51. #define _ncalloc(num,size)      calloc(num,size)
  52. #define _nheapmin()             0
  53. #if !defined(_Windows)
  54. #define _memavl()               coreleft()
  55. #endif
  56.  
  57. #endif  /* small data models */
  58.  
  59. /* Model-independent functions */
  60.  
  61. #define _fmalloc(size)          farmalloc((unsigned long)(size))
  62. #define _ffree(block)           farfree(block)
  63. #define _frealloc(block,size)   farrealloc(block,(unsigned long)(size))
  64. #define _fcalloc(num,size)      farcalloc((unsigned long)(num),(unsigned long)(size))
  65. #define halloc(num,size)        (void huge *)_farmalloc((unsigned long)(num)*(size))
  66. #define hfree(block)            farfree((void far *)(block))
  67. #define _heapmin()              0
  68. #define _fheapmin()             0
  69.  
  70. #if !defined(_Windows)
  71. int         _RTLENTRY _EXPFUNC _heapwalk   (_HEAPINFO *__entry);
  72. #endif
  73.  
  74. /* Prototypes */
  75.  
  76. void *      _Cdecl alloca     (size_t __size);
  77. void *      _Cdecl __alloca__ (size_t __size);
  78. #if defined(__BCOPT__ ) && !defined(_Windows)
  79. #define     alloca  __alloca__
  80. #endif
  81. size_t      _Cdecl stackavail (void);
  82.  
  83. #else  /* __FLAT__ */
  84.  
  85. /* Prototypes */
  86.  
  87. void *      __cdecl   _EXPFUNC alloca( size_t __size );
  88. void *      __cdecl            __alloca__ (size_t __size);
  89.  
  90. size_t      _RTLENTRY _EXPFUNC stackavail  (void);
  91. int         _RTLENTRY _EXPFUNC _heapadd    (void * __block, size_t __size);
  92. int         _RTLENTRY _EXPFUNC _heapchk    (void);
  93. int         _RTLENTRY _EXPFUNC _heapmin    (void);
  94. int         _RTLENTRY _EXPFUNC _heapset    (unsigned int __fill);
  95. int         _RTLENTRY _EXPFUNC _heapwalk   (_HEAPINFO *__entry);
  96. int         _RTLENTRY _EXPFUNC _rtl_heapwalk (_HEAPINFO *__entry);
  97. void *      _RTLENTRY _EXPFUNC _expand     (void * __block, size_t __size);
  98. size_t      _RTLENTRY _EXPFUNC _msize      (void * __block );
  99.  
  100.  
  101. #endif  /* __FLAT__ */
  102.  
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106.  
  107. /* Obsolete functions */
  108. #if !defined(RC_INVOKED) && !defined(_Windows) && !defined(__FLAT__)
  109. #pragma obsolete _heapwalk
  110. #endif
  111.  
  112. #endif  /* __MALLOC_H */
  113.