VirtualBox

source: kStuff/trunk/include/k/kHlpAlloc.h@ 2

Last change on this file since 2 was 2, checked in by bird, 17 years ago

Imported http://svn.netlabs.org/repos/libc/trunk/kStuff, revision 3612.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.0 KB
Line 
1/* $Id: kHlpAlloc.h 2 2007-11-16 16:07:14Z bird $ */
2/** @file
3 * kHlpAlloc - Memory Allocation.
4 */
5
6/*
7 * Copyright (c) 2006-2007 knut st. osmundsen <[email protected]>
8 *
9 * This file is part of kStuff.
10 *
11 * kStuff is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * kStuff is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with kStuff; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#ifndef ___k_kHlpAlloc_h___
28#define ___k_kHlpAlloc_h___
29
30#include <k/kHlpDefs.h>
31#include <k/kTypes.h>
32
33/** @defgroup grp_kHlpAlloc kHlpAlloc - Memory Allocation
34 * @addtogroup grp_kHlp
35 * @{*/
36
37/** @def kHlpAllocA
38 * The alloca() wrapper. */
39#ifdef __GNUC__
40# define kHlpAllocA(a) __builtin_alloca(a)
41#elif defined(_MSC_VER)
42# include <malloc.h>
43# define kHlpAllocA(a) alloca(a)
44#else
45# error "Port Me."
46#endif
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52KHLP_DECL(void *) kHlpAlloc(KSIZE cb);
53KHLP_DECL(void *) kHlpAllocZ(KSIZE cb);
54KHLP_DECL(void *) kHlpDup(const void *pv, KSIZE cb);
55KHLP_DECL(char *) kHlpStrDup(const char *psz);
56KHLP_DECL(void *) kHlpRealloc(void *pv, KSIZE cb);
57KHLP_DECL(void) kHlpFree(void *pv);
58
59KHLP_DECL(int) kHlpPageAlloc(void **ppv, KSIZE cb, KPROT enmProt, KBOOL fFixed);
60KHLP_DECL(int) kHlpPageProtect(void *pv, KSIZE cb, KPROT enmProt);
61KHLP_DECL(int) kHlpPageFree(void *pv, KSIZE cb);
62
63KHLP_DECL(int) kHlpHeapInit(void);
64KHLP_DECL(void) kHlpHeapTerm(void);
65KHLP_DECL(void) kHlpHeapDonate(void *pv, KSIZE cb);
66
67#ifdef __cplusplus
68}
69#endif
70
71/** @} */
72
73#endif
74
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette