home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / bloodshed / devcpp-4.9.9.2_setup.exe / malloc.h < prev    next >
C/C++ Source or Header  |  2005-01-29  |  3KB  |  91 lines

  1. /*
  2.  * malloc.h
  3.  * This file has no copyright assigned and is placed in the Public Domain.
  4.  * This file is a part of the mingw-runtime package.
  5.  * No warranty is given; refer to the file DISCLAIMER within the package.
  6.  *
  7.  * Support for programs which want to use malloc.h to get memory management
  8.  * functions. Unless you absolutely need some of these functions and they are
  9.  * not in the ANSI headers you should use the ANSI standard header files
  10.  * instead.
  11.  *
  12.  */
  13.  
  14. #ifndef _MALLOC_H_
  15. #define _MALLOC_H_
  16.  
  17. /* All the headers include this file. */
  18. #include <_mingw.h>
  19.  
  20. #include <stdlib.h>
  21.  
  22. #ifndef RC_INVOKED
  23.  
  24. /*
  25.  * The structure used to walk through the heap with _heapwalk.
  26.  */
  27. typedef    struct _heapinfo
  28. {
  29.     int*    _pentry;
  30.     size_t    _size;
  31.     int    _useflag;
  32. } _HEAPINFO;
  33.  
  34. /* Values for _heapinfo.useflag */
  35. #define _USEDENTRY 0
  36. #define _FREEENTRY 1
  37.  
  38. #ifdef    __cplusplus
  39. extern "C" {
  40. #endif
  41. /*
  42.    The _heap* memory allocation functions are supported on NT
  43.    but not W9x. On latter, they always set errno to ENOSYS.
  44. */
  45. _CRTIMP int __cdecl _heapwalk (_HEAPINFO*);
  46. #ifdef __GNUC__
  47. #define _alloca(x) __builtin_alloca((x))
  48. #endif
  49.  
  50. #ifndef    _NO_OLDNAMES
  51. _CRTIMP int __cdecl heapwalk (_HEAPINFO*);
  52. #ifdef __GNUC__
  53. #define alloca(x) __builtin_alloca((x))
  54. #endif
  55. #endif    /* Not _NO_OLDNAMES */
  56.  
  57. _CRTIMP int __cdecl _heapchk (void);    /* Verify heap integrety. */
  58. _CRTIMP int __cdecl _heapmin (void);    /* Return unused heap to the OS. */
  59. _CRTIMP int __cdecl _heapset (unsigned int);
  60.  
  61. _CRTIMP size_t __cdecl _msize (void*);
  62. _CRTIMP size_t __cdecl _get_sbh_threshold (void); 
  63. _CRTIMP int __cdecl _set_sbh_threshold (size_t);
  64. _CRTIMP void* __cdecl _expand (void*, size_t); 
  65.  
  66. /* These require msvcr70.dll or higher. */ 
  67. #if __MSVCRT_VERSION__ >= 0x0700
  68. _CRTIMP void * __cdecl _aligned_offset_malloc(size_t, size_t, size_t);
  69. _CRTIMP void * __cdecl _aligned_offset_realloc(void*, size_t, size_t, size_t);
  70.  
  71. _CRTIMP void * __cdecl _aligned_malloc (size_t, size_t);
  72. _CRTIMP void * __cdecl _aligned_realloc (void*, size_t, size_t);
  73. _CRTIMP void __cdecl _aligned_free (void*);
  74. #endif /* __MSVCRT_VERSION__ >= 0x0700 */
  75.  
  76. /* These require libmingwex.a. */ 
  77. void * __cdecl __mingw_aligned_offset_malloc (size_t, size_t, size_t);
  78. void * __cdecl __mingw_aligned_offset_realloc (void*, size_t, size_t, size_t);
  79.  
  80. void * __cdecl __mingw_aligned_malloc (size_t, size_t);
  81. void * __cdecl __mingw_aligned_realloc (void*, size_t, size_t);
  82. void __cdecl __mingw_aligned_free (void*);
  83.  
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87.  
  88. #endif    /* RC_INVOKED */
  89.  
  90. #endif /* Not _MALLOC_H_ */
  91.