From 9dcd1c909aeb21a7690ecbdd667562800431ca42 Mon Sep 17 00:00:00 2001 From: CPunch Date: Fri, 27 Nov 2020 19:42:00 -0600 Subject: [PATCH] fixed needless pop in _main chunk --- src/cparse.c | 2 +- src/ctable.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cparse.c b/src/cparse.c index 75d1821..c5a8c87 100644 --- a/src/cparse.c +++ b/src/cparse.c @@ -1206,7 +1206,7 @@ CObjFunction* cosmoP_compileString(CState *state, const char *source) { consume(&parser, TOKEN_EOF, "End of file expected!"); - popLocals(&parser, -1); // needed to close over the values + popLocals(&parser, 0); if (parser.hadError) { // we don't free the function, the state already has a reference to it in it's linked list of objects! endCompiler(&parser); diff --git a/src/ctable.c b/src/ctable.c index ede7763..5e70fd4 100644 --- a/src/ctable.c +++ b/src/ctable.c @@ -151,7 +151,7 @@ static void resizeTbl(CState *state, CTable *tbl, int newCapacity, bool canShrin bool cosmoT_checkShrink(CState *state, CTable *tbl) { // if count > 8 and active entries < tombstones - if (tbl->count > MIN_TABLE_CAPACITY && (tbl->count - tbl->tombstones < tbl->tombstones || tbl->tombstones > 50)) { + if (tbl->count > MIN_TABLE_CAPACITY && (tbl->count - tbl->tombstones < tbl->tombstones || tbl->tombstones > 50)) { // TODO: 50 should be a threshhold resizeTbl(state, tbl, nextPow2(tbl->count - tbl->tombstones) * GROW_FACTOR, false); // shrink based on active entries to the next pow of 2 return true; }