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

Last change on this file since 3550 was 3550, checked in by bird, 18 years ago

made kDbg compile again (not linking yet though).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1/* $Id: kHlpAlloc.h 3550 2007-08-26 01:13:35Z bird $ */
2/** @file
3 * kHlpAlloc - Memory Allocation.
4 */
5
6/*
7 * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
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/kDefs.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
52void * kHlpAlloc(KSIZE cb);
53void * kHlpAllocZ(KSIZE cb);
54void * kHlpDup(const void *pv, KSIZE cb);
55const char *kHlpStrDup(const char *psz);
56void * kHlpRealloc(void *pv, KSIZE cb);
57void kHlpFree(void *pv);
58
59int kHlpPageAlloc(void **ppv, KSIZE cb, KPROT enmProt, KBOOL fFixed);
60int kHlpPageProtect(void *pv, KSIZE cb, KPROT enmProt);
61int kHlpPageFree(void *pv, KSIZE cb);
62
63#ifdef __cplusplus
64}
65#endif
66
67/** @} */
68
69#endif
70
Note: See TracBrowser for help on using the repository browser.