straightened out a situation with alloca

[[Split portion of a mixed commit.]]
This commit is contained in:
zeromus 2006-07-24 00:26:07 +00:00
parent 5b4f266680
commit 25c29cca28
3 changed files with 12 additions and 3 deletions

View File

@ -82,7 +82,7 @@ int FCEUNET_SendCommand(uint8 cmd, uint32 len)
{ {
//mbg merge 7/17/06 changed to alloca //mbg merge 7/17/06 changed to alloca
//uint8 buf[numlocal + 1 + 4]; //uint8 buf[numlocal + 1 + 4];
uint8 *buf = (uint8*)_alloca(numlocal+1+4); uint8 *buf = (uint8*)alloca(numlocal+1+4);
buf[0] = 0xFF; buf[0] = 0xFF;

View File

@ -22,6 +22,8 @@
#ifndef __FCEU_TYPES #ifndef __FCEU_TYPES
#define __FCEU_TYPES #define __FCEU_TYPES
#include <stdlib.h>
#define FCEU_VERSION_NUMERIC 9816 #define FCEU_VERSION_NUMERIC 9816
#define FCEU_NAME "FCEUX" #define FCEU_NAME "FCEUX"
#define FCEU_VERSION_STRING "1.07" #define FCEU_VERSION_STRING "1.07"
@ -47,11 +49,18 @@ typedef signed int int32;
#define stat _stat #define stat _stat
#define fstat _fstat #define fstat _fstat
#define mkdir _mkdir #define mkdir _mkdir
#define alloca _alloca
#define W_OK 2 #define W_OK 2
#define R_OK 2 #define R_OK 2
#define X_OK 1 #define X_OK 1
#define F_OK 0 #define F_OK 0
#else #else
//mingw32 doesnt prototype this for some reason
#ifdef __MINGW32__
void *alloca(size_t);
#endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>

View File

@ -18,7 +18,7 @@ void FCEU_WriteWaveData(int32 *Buffer, int Count)
{ {
//mbg merge 7/17/06 changed to alloca //mbg merge 7/17/06 changed to alloca
//int16 temp[Count]; /* Yay. Is this the first use of this "feature" of C in FCE Ultra? */ //int16 temp[Count]; /* Yay. Is this the first use of this "feature" of C in FCE Ultra? */
int16 *temp = (int16*)_alloca(Count*2); int16 *temp = (int16*)alloca(Count*2);
int16 *dest; int16 *dest;
int x; int x;
@ -52,7 +52,7 @@ void FCEU_WriteWaveData(int32 *Buffer, int Count)
{ {
//mbg merge 7/17/06 changed to alloca //mbg merge 7/17/06 changed to alloca
//int8 temp2[Count]; //int8 temp2[Count];
int8 *temp2 = (int8*)_alloca(Count); int8 *temp2 = (int8*)alloca(Count);
int P; int P;
for(P=0;P<Count;P++) for(P=0;P<Count;P++)
*(((uint8*)temp2)+P)=((int8)(temp[P]>>8))^128; *(((uint8*)temp2)+P)=((int8)(temp[P]>>8))^128;