Update mingw headers to version 3.13
[reactos.git] / reactos / include / crt / malloc.h
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 _FREEENTRY 0
36 #define _USEDENTRY 1
37
38 /* Return codes for _heapwalk() */
39 #define _HEAPEMPTY (-1)
40 #define _HEAPOK (-2)
41 #define _HEAPBADBEGIN (-3)
42 #define _HEAPBADNODE (-4)
43 #define _HEAPEND (-5)
44 #define _HEAPBADPTR (-6)
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 /*
50 The _heap* memory allocation functions are supported on NT
51 but not W9x. On latter, they always set errno to ENOSYS.
52 */
53 _CRTIMP int __cdecl __MINGW_NOTHROW _heapwalk (_HEAPINFO*);
54 #ifdef __GNUC__
55 #define _alloca(x) __builtin_alloca((x))
56 #endif
57
58 #ifndef _NO_OLDNAMES
59 _CRTIMP int __cdecl __MINGW_NOTHROW heapwalk (_HEAPINFO*);
60 #ifdef __GNUC__
61 #define alloca(x) __builtin_alloca((x))
62 #endif
63 #endif /* Not _NO_OLDNAMES */
64
65 _CRTIMP int __cdecl __MINGW_NOTHROW _heapchk (void); /* Verify heap integrety. */
66 _CRTIMP int __cdecl __MINGW_NOTHROW _heapmin (void); /* Return unused heap to the OS. */
67 _CRTIMP int __cdecl __MINGW_NOTHROW _heapset (unsigned int);
68
69 _CRTIMP size_t __cdecl __MINGW_NOTHROW _msize (void*);
70 _CRTIMP size_t __cdecl __MINGW_NOTHROW _get_sbh_threshold (void);
71 _CRTIMP int __cdecl __MINGW_NOTHROW _set_sbh_threshold (size_t);
72 _CRTIMP void* __cdecl __MINGW_NOTHROW _expand (void*, size_t);
73
74 /* These require msvcr70.dll or higher. */
75 #if __MSVCRT_VERSION__ >= 0x0700
76 _CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_malloc(size_t, size_t, size_t);
77 _CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_realloc(void*, size_t, size_t, size_t);
78
79 _CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_malloc (size_t, size_t);
80 _CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_realloc (void*, size_t, size_t);
81 _CRTIMP void __cdecl __MINGW_NOTHROW _aligned_free (void*);
82 #endif /* __MSVCRT_VERSION__ >= 0x0700 */
83
84 /* These require libmingwex.a. */
85 void * __cdecl __MINGW_NOTHROW __mingw_aligned_offset_malloc (size_t, size_t, size_t);
86 void * __cdecl __MINGW_NOTHROW __mingw_aligned_offset_realloc (void*, size_t, size_t, size_t);
87
88 void * __cdecl __MINGW_NOTHROW __mingw_aligned_malloc (size_t, size_t);
89 void * __cdecl __MINGW_NOTHROW __mingw_aligned_realloc (void*, size_t, size_t);
90 void __cdecl __MINGW_NOTHROW __mingw_aligned_free (void*);
91
92 #ifdef __cplusplus
93 }
94 #endif
95
96 #endif /* RC_INVOKED */
97
98 #endif /* Not _MALLOC_H_ */