1.1 --- a/sourcepawn/jit/sp_vm_engine.cpp Mon Dec 15 18:47:11 2008 +1300
1.2 +++ b/sourcepawn/jit/sp_vm_engine.cpp Tue Dec 23 01:33:37 2008 -0500
1.3 @@ -29,7 +29,7 @@
1.4 * Version: $Id$
1.5 */
1.6
1.7 -#include <malloc.h>
1.8 +#include <stdlib.h>
1.9 #include <string.h>
1.10 #include <assert.h>
1.11 #include "sp_vm_types.h"
1.12 @@ -111,7 +111,11 @@
1.13 #if defined WIN32
1.14 return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
1.15 #elif defined __GNUC__
1.16 +# if defined __APPLE__
1.17 + void *base = valloc(size);
1.18 +# else
1.19 void *base = memalign(sysconf(_SC_PAGESIZE), size);
1.20 +# endif
1.21 if (mprotect(base, size, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
1.22 {
1.23 free(base);