diff options
Diffstat (limited to 'clox/src/table.c')
-rw-r--r-- | clox/src/table.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clox/src/table.c b/clox/src/table.c index ae34ab0..134f455 100644 --- a/clox/src/table.c +++ b/clox/src/table.c @@ -141,6 +141,15 @@ ObjString *tableFindString(Table *table, const char *chars, int length, } } +void tableRemoveWhite(Table *table) { + for (int i = 0; i < table->capacity; i++) { + Entry *entry = &table->entries[i]; + if (entry->key != NULL && !entry->key->obj.isMarked) { + tableDelete(table, entry->key); + } + } +} + void markTable(Table *table) { for (int i = 0; i < table->capacity; i++) { Entry *entry = &table->entries[i]; |