fix more GC bugs

This commit is contained in:
2023-08-29 23:21:52 -05:00
committed by cpunch
parent d41126e75f
commit 6a47c82179
10 changed files with 57 additions and 47 deletions

View File

@@ -54,7 +54,7 @@ static void resetBuffer(CLexState *state)
// cancels the token heap buffer and frees it
static void freeBuffer(CLexState *state)
{
cosmoM_freearray(state->cstate, char, state->buffer, state->bufCap);
cosmoM_freeArray(state->cstate, char, state->buffer, state->bufCap);
resetBuffer(state);
}
@@ -62,7 +62,7 @@ static void freeBuffer(CLexState *state)
// adds character to buffer
static void appendBuffer(CLexState *state, char c)
{
cosmoM_growarray(state->cstate, char, state->buffer, state->bufCount, state->bufCap);
cosmoM_growArray(state->cstate, char, state->buffer, state->bufCount, state->bufCap);
state->buffer[state->bufCount++] = c;
}
@@ -90,7 +90,7 @@ static char *cutBuffer(CLexState *state, int *length)
resetBuffer(state);
// shrink the buffer to only use what we need
return cosmoM_reallocate(state->cstate, buf, cap, count);
return cosmoM_reallocate(state->cstate, buf, cap, count, true);
}
static CToken makeToken(CLexState *state, CTokenType type)