malloc -> alloca

This commit is contained in:
Veit Heller committed 2014-11-01 14:35:23 +01:00
1 parent f4c005a2fc
commit c332a38b36
2 files changed
+2 -4

No files matched your search

+1 -4
View File
@@ -28,7 +28,7 @@ static inline void disassemble(int sp, int fp, int ip, int opcode, instruction*
}
void vm_execute(int code[], int ip, int datasize, unsigned long length){
int* data = (int *) malloc((unsigned long)datasize * sizeof(int));
int* data = (int *) alloca((size_t)datasize * sizeof(int));
int stack[MAX_SIZE];
int sp = -1;
int fp = -1;
@@ -159,9 +159,6 @@ void vm_execute(int code[], int ip, int datasize, unsigned long length){
die(127, "Exit on program failure.");
}
}
free(data);
return;
}
+1
View File
@@ -4,6 +4,7 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <alloca.h>
#include "util.h"
#include "opcode.h"