comparison include/LocalAlloc.h @ 0:92745d501b9a

initial import from kinput2-v3.1
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 08 Mar 2010 04:44:30 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92745d501b9a
1 /* $Id: LocalAlloc.h,v 1.2 1991/01/22 11:53:28 ishisone Rel $ */
2
3 /*
4 * (fast) local allocator macro
5 *
6 * if you use gcc, don't worry.
7 * if you use cc and have reliable alloca(), define HAVE_ALLOCA.
8 */
9
10 #ifdef __GNUC__
11 #define LOCAL_ALLOC(x) __builtin_alloca((unsigned int)(x))
12 #define LOCAL_FREE(x)
13 #else
14 #ifdef HAVE_ALLOCA
15 #ifdef INCLUDE_ALLOCA_H
16 #include <alloca.h>
17 #endif
18 #define LOCAL_ALLOC(x) alloca((unsigned int)(x))
19 #define LOCAL_FREE(x)
20 #else
21 #define LOCAL_ALLOC(x) malloc((unsigned int)(x))
22 #define LOCAL_FREE(x) free((char *)(x))
23 #endif /* HAVE_ALLOCA */
24 #endif /* __GNUC__ */