branch update for HEAD-2003021201
[reactos.git] / include / msvcrt / alloc.h
1 /*
2  * alloc.h
3  *
4  * Memory management functions. Because most of these functions are
5  * actually declared in stdlib.h I have decided to simply include that
6  * header file. This file is included by malloc.h. My head hurts...
7  *
8  * NOTE: In the version of the Standard C++ Library from Cygnus there
9  * is also an alloc.h which needs to be on your include path. Most of
10  * the time I think the most sensible option would be to get rid of
11  * this file.
12  *
13  * This file is part of the Mingw32 package.
14  *
15  * Contributors:
16  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
17  *
18  *  THIS SOFTWARE IS NOT COPYRIGHTED
19  *
20  *  This source code is offered for use in the public domain. You may
21  *  use, modify or distribute it freely.
22  *
23  *  This code is distributed in the hope that it will be useful but
24  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
25  *  DISCLAIMED. This includes but is not limited to warranties of
26  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27  *
28  * $Revision$
29  * $Author$
30  * $Date$
31  *
32  */
33
34 #ifndef __STRICT_ANSI__
35
36 #ifndef _ALLOC_H_
37 #define _ALLOC_H_
38
39 #include <msvcrt/stdlib.h>
40
41 #ifndef RC_INVOKED
42
43 #ifdef  __cplusplus
44 extern "C" {
45 #endif
46
47 /*
48  * The structure used to walk through the heap with _heapwalk.
49  * TODO: This is a guess at the internals of this structure.
50  */
51 typedef struct _heapinfo
52 {
53     void* ptr;
54     unsigned int size;
55     int in_use;
56 } _HEAPINFO;
57
58 int _heapwalk(_HEAPINFO* pHeapinfo);
59  
60 #ifdef __GNUC__
61 #ifdef USE_C_ALLOCA
62 void* C_alloca(size_t size);
63 #define _alloca(x)  C_alloca(x)
64 #else   /* USE_C_ALLOCA */
65 #define _alloca(x)  __builtin_alloca(x)
66 #endif  /* USE_C_ALLOCA */
67 #else   /* __GNUC__ */
68 void* _alloca(size_t size);
69 #endif  /* __GNUC__ */
70
71
72 #ifndef _NO_OLDNAMES
73 #define heapwalk(x) _heapwalk(x)
74 #define alloca(s)   _alloca(s)
75 #endif  /* Not _NO_OLDNAMES */
76
77 #ifdef  __cplusplus
78 }
79 #endif
80
81 #endif  /* Not RC_INVOKED */
82
83 #endif  /* Not _ALLOC_H_ */
84
85 #endif  /* Not __STRICT_ANSI__ */
86