From 1d2ba217afe144c9e2fc67279001f05e69ae4ef6 Mon Sep 17 00:00:00 2001 From: CPunch Date: Fri, 25 Aug 2023 23:34:21 -0500 Subject: [PATCH] minor refactoring --- src/cmem.c | 4 +++- src/cobj.c | 2 +- src/cvm.c | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmem.c b/src/cmem.c index e8c9e55..79e3588 100644 --- a/src/cmem.c +++ b/src/cmem.c @@ -10,7 +10,9 @@ // realloc wrapper void *cosmoM_reallocate(CState *state, void *buf, size_t oldSize, size_t newSize) { - if (buf == NULL) oldSize = 0; + if (buf == NULL) + oldSize = 0; + #ifdef GC_DEBUG printf("old allocated bytes: %ld\n", state->allocatedBytes); if (buf) { diff --git a/src/cobj.c b/src/cobj.c index 15aed52..19f0a6d 100644 --- a/src/cobj.c +++ b/src/cobj.c @@ -188,10 +188,10 @@ CObjObject *cosmoO_newObject(CState *state) obj->userP = NULL; // reserved for C API obj->userT = 0; obj->isLocked = false; + cosmoV_pushRef(state, (CObj *)obj); // so our GC can keep track of it cosmoT_initTable(state, &obj->tbl, ARRAY_START); cosmoV_pop(state); - return obj; } diff --git a/src/cvm.c b/src/cvm.c index 88f9b4b..865e634 100644 --- a/src/cvm.c +++ b/src/cvm.c @@ -764,7 +764,6 @@ int cosmoV_execute(CState *state) { uint8_t indx = READBYTE(frame); cosmoV_pushValue(state, frame->base[indx]); - continue; } CASE(OP_GETUPVAL) : {