]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/common/bits/uClibc_alloc.h
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / common / bits / uClibc_alloc.h
1 /*
2  * Macros to transparently switch between the stack and heap for large
3  * allocations.  The former is useful on MMU systems as it results in
4  * smaller code, but the latter is required on NoMMU systems.  This is
5  * due to small stacks that cannot grow and so doing large allocs will
6  * cause a stack overflow.
7  *
8  * Copyright (C) 2010 Mike Frysinger <vapier@gentoo.org>
9  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10  */
11
12 #ifndef _UCLIBC_ALLOC_H
13 #define _UCLIBC_ALLOC_H
14
15 #include <alloca.h>
16 #include <stdlib.h>
17
18 #ifdef __ARCH_USE_MMU__
19 # define stack_heap_alloc(x) alloca(x)
20 # define stack_heap_free(x)  do { if (0) free(x); } while (0)
21 #else
22 # define stack_heap_alloc(x) malloc(x)
23 # define stack_heap_free(x)  free(x)
24 #endif
25
26 #endif