mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-25 00:21:05 +00:00
minor refactoring
This commit is contained in:
parent
e28ffe1c6c
commit
1d2ba217af
@ -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) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user