Fixed casting malloc return type for pthread.c and added alloca compatibility code for Visual Studio.