From 008f173f9b9e52ae41683939614239059c0d3b04 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 19 Oct 2021 18:21:25 +0200 Subject: Change string/symbol representation to use darray.h --- src/bootstrap/gc.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/bootstrap/gc.c') diff --git a/src/bootstrap/gc.c b/src/bootstrap/gc.c index a72f718..48499ac 100644 --- a/src/bootstrap/gc.c +++ b/src/bootstrap/gc.c @@ -121,17 +121,9 @@ mark_and_sweep(void) { if (!obj->marked) { // Free heap allocated memory for this object if needed. if (obj->type == OBJ_TYPE_SYMBOL) { - if (obj->symbol != NULL) { - free(obj->symbol); - } - obj->symbol = NULL; - obj->symbol_n = 0; + array_free(obj->symbol); } else if (obj->type == OBJ_TYPE_STRING) { - if (obj->symbol != NULL) { - free(obj->string); - } - obj->string = NULL; - obj->string_n = 0; + array_free(obj->string); } gc.free_objects.buf[gc.free_objects.size++] = i; } -- cgit v1.2.1