X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibspiderscript.so_src%2Fbytecode_gen.c;h=c718265eb38ca27c63a4c7543ea4ffacf28540f6;hb=239f2374299c1471a40b1087725b32f3f163d9b3;hp=078f2df1b31aa39ac8c3efb30a78871b2dae2892;hpb=2c8989ea0849b0e207e6c357626d41c991dc423f;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libspiderscript.so_src/bytecode_gen.c b/Usermode/Libraries/libspiderscript.so_src/bytecode_gen.c index 078f2df1..c718265e 100644 --- a/Usermode/Libraries/libspiderscript.so_src/bytecode_gen.c +++ b/Usermode/Libraries/libspiderscript.so_src/bytecode_gen.c @@ -38,15 +38,14 @@ tBC_Op *Bytecode_int_AllocateOp(int Operation) return ret; } -tBC_Function *Bytecode_CreateFunction(const char *Name, int ArgCount, char **ArgNames, int *ArgTypes) +tBC_Function *Bytecode_CreateFunction(tScript_Function *Fcn) { tBC_Function *ret; int i; - ret = malloc(sizeof(tBC_Function) + ArgCount*sizeof(ret->Arguments[0])); + ret = malloc(sizeof(tBC_Function)); if(!ret) return NULL; - ret->Name = Name; ret->LabelSpace = ret->LabelCount = 0; ret->Labels = NULL; @@ -59,12 +58,9 @@ tBC_Function *Bytecode_CreateFunction(const char *Name, int ArgCount, char **Arg ret->Operations = NULL; ret->OperationsEnd = (void*)&ret->Operations; - ret->ArgumentCount = ArgCount; - for( i = 0; i < ArgCount; i ++ ) + for( i = 0; i < Fcn->ArgumentCount; i ++ ) { - ret->Arguments[i].Name = strdup(ArgNames[i]); - ret->Arguments[i].Type = ArgTypes[i]; - Bytecode_int_AddVariable(ret, ret->Arguments[i].Name); + Bytecode_int_AddVariable(ret, Fcn->Arguments[i].Name); } return ret; @@ -73,11 +69,6 @@ tBC_Function *Bytecode_CreateFunction(const char *Name, int ArgCount, char **Arg void Bytecode_DeleteFunction(tBC_Function *Fcn) { tBC_Op *op; - int i; - for( i = 0; i < Fcn->ArgumentCount; i ++ ) - { - free(Fcn->Arguments[i].Name); - } for( op = Fcn->Operations; op; ) { tBC_Op *nextop = op->Next;