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
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)
22 # define stack_heap_alloc(x) malloc(x)
23 # define stack_heap_free(x) free(x)