_alloca() for Win32
authorJean-Marc Valin <jean-marc.valin@octasic.com>
Tue, 31 Aug 2010 15:56:09 +0000 (11:56 -0400)
committerJean-Marc Valin <jean-marc.valin@octasic.com>
Tue, 31 Aug 2010 15:56:09 +0000 (11:56 -0400)
libcelt/stack_alloc.h

index 95f40d4..62a00b5 100644 (file)
 #elif defined(USE_ALLOCA)
 
 #define VARDECL(type, var) type *var
-#define ALLOC(var, size, type) var = ((type*)alloca(sizeof(type)*(size)))
+
+# ifdef WIN32
+#  define ALLOC(var, size, type) var = ((type*)_alloca(sizeof(type)*(size)))
+# else
+#  define ALLOC(var, size, type) var = ((type*)alloca(sizeof(type)*(size)))
+# endif
+
 #define SAVE_STACK
 #define RESTORE_STACK
 #define ALLOC_STACK