[PATCH] libc/sysdeps/linux/common/bits/wchar.h: resync with glibc, fix build issue...
[uclibc-ng.git] / libc / sysdeps / linux / common / bits / uClibc_alloc.h
blob6a70d27b7084407717827b726efdfc068fe93b64
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.
8 * Copyright (C) 2010 Mike Frysinger <vapier@gentoo.org>
9 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
12 #ifndef _UCLIBC_ALLOC_H
13 #define _UCLIBC_ALLOC_H
15 #include <alloca.h>
16 #include <stdlib.h>
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
26 #endif