source: Daodan/MinGW/include/malloc.h@ 1163

Last change on this file since 1163 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 3.2 KB
RevLine 
[1046]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 */
27typedef 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/* maximum size of a user request for memory */
47#define _HEAP_MAXREQ 0xFFFFFFE0
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52/*
53 The _heap* memory allocation functions are supported on NT
54 but not W9x. On latter, they always set errno to ENOSYS.
55*/
56_CRTIMP int __cdecl __MINGW_NOTHROW _heapwalk (_HEAPINFO*);
57#ifdef __GNUC__
58#define _alloca(x) __builtin_alloca((x))
59#endif
60
61#ifndef _NO_OLDNAMES
62_CRTIMP int __cdecl __MINGW_NOTHROW heapwalk (_HEAPINFO*);
63#ifdef __GNUC__
64#define alloca(x) __builtin_alloca((x))
65#endif
66#endif /* Not _NO_OLDNAMES */
67
68_CRTIMP int __cdecl __MINGW_NOTHROW _heapchk (void); /* Verify heap integrety. */
69_CRTIMP int __cdecl __MINGW_NOTHROW _heapmin (void); /* Return unused heap to the OS. */
70_CRTIMP int __cdecl __MINGW_NOTHROW _heapset (unsigned int);
71
72_CRTIMP size_t __cdecl __MINGW_NOTHROW _msize (void*);
73_CRTIMP size_t __cdecl __MINGW_NOTHROW _get_sbh_threshold (void);
74_CRTIMP int __cdecl __MINGW_NOTHROW _set_sbh_threshold (size_t);
75_CRTIMP void* __cdecl __MINGW_NOTHROW _expand (void*, size_t);
76
77/* These require msvcr70.dll or higher. */
78#if __MSVCRT_VERSION__ >= 0x0700
79_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_malloc(size_t, size_t, size_t);
80_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_realloc(void*, size_t, size_t, size_t);
81_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_recalloc(void*, size_t, size_t, size_t, size_t);
82
83_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_malloc (size_t, size_t);
84_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_realloc (void*, size_t, size_t);
85_CRTIMP void* __cdecl __MINGW_NOTHROW _aligned_recalloc(void*, size_t, size_t, size_t);
86_CRTIMP void __cdecl __MINGW_NOTHROW _aligned_free (void*);
87#endif /* __MSVCRT_VERSION__ >= 0x0700 */
88
89/* These require libmingwex.a. */
90void * __cdecl __MINGW_NOTHROW __mingw_aligned_offset_malloc (size_t, size_t, size_t);
91void * __cdecl __MINGW_NOTHROW __mingw_aligned_offset_realloc (void*, size_t, size_t, size_t);
92
93void * __cdecl __MINGW_NOTHROW __mingw_aligned_malloc (size_t, size_t);
94void * __cdecl __MINGW_NOTHROW __mingw_aligned_realloc (void*, size_t, size_t);
95void __cdecl __MINGW_NOTHROW __mingw_aligned_free (void*);
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif /* RC_INVOKED */
102
103#endif /* Not _MALLOC_H_ */
Note: See TracBrowser for help on using the repository browser.