minor refactoring

This commit is contained in:
CPunch 2023-08-25 23:34:21 -05:00
parent e28ffe1c6c
commit 1d2ba217af
3 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,9 @@
// realloc wrapper // realloc wrapper
void *cosmoM_reallocate(CState *state, void *buf, size_t oldSize, size_t newSize) 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 #ifdef GC_DEBUG
printf("old allocated bytes: %ld\n", state->allocatedBytes); printf("old allocated bytes: %ld\n", state->allocatedBytes);
if (buf) { if (buf) {

View File

@ -188,10 +188,10 @@ CObjObject *cosmoO_newObject(CState *state)
obj->userP = NULL; // reserved for C API obj->userP = NULL; // reserved for C API
obj->userT = 0; obj->userT = 0;
obj->isLocked = false; obj->isLocked = false;
cosmoV_pushRef(state, (CObj *)obj); // so our GC can keep track of it cosmoV_pushRef(state, (CObj *)obj); // so our GC can keep track of it
cosmoT_initTable(state, &obj->tbl, ARRAY_START); cosmoT_initTable(state, &obj->tbl, ARRAY_START);
cosmoV_pop(state); cosmoV_pop(state);
return obj; return obj;
} }

View File

@ -764,7 +764,6 @@ int cosmoV_execute(CState *state)
{ {
uint8_t indx = READBYTE(frame); uint8_t indx = READBYTE(frame);
cosmoV_pushValue(state, frame->base[indx]); cosmoV_pushValue(state, frame->base[indx]);
continue;
} }
CASE(OP_GETUPVAL) : CASE(OP_GETUPVAL) :
{ {