X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=templates%2Ffunction_definition.c;h=d20eba676f34f5a880b66ef3280b28477d2a39a3;hp=c483bda5827ce9d47934afa660ff12ea3713f0be;hb=b47a0017d1dbfda8e8bae7989fff9ccb31897a28;hpb=1f2895250c61aeb81c0f0ba7efed156c9386dfac diff --git a/templates/function_definition.c b/templates/function_definition.c index c483bda..d20eba6 100644 --- a/templates/function_definition.c +++ b/templates/function_definition.c @@ -3,9 +3,7 @@ Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environmen { environment = Environment_construct(environmentPool, environment); - Stack stackMemory; - Stack* stack = &stackMemory; - Stack_initialize(stack); + Stack* stack = Stack_construct(); jmp_buf jump; if(setjmp(jump) != 0) @@ -19,6 +17,8 @@ Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environmen } Environment_setLive(environment, false); + Stack_destruct(stack); + longjmp(parentJump, 1); } @@ -34,5 +34,7 @@ Object user${{name}}$implementation(EnvironmentPool* environmentPool, Environmen // TODO Set the environment back to the parent environment Environment_setLive(environment, false); + + Stack_destruct(stack); return result; }