diff options
-rw-r--r-- | eval.c | 6 | ||||
-rw-r--r-- | foreign.c | 17 | ||||
-rw-r--r-- | main.c | 6 |
3 files changed, 4 insertions, 25 deletions
@@ -16,11 +16,7 @@ static void evalr_create(Evaluator *ev, Typer *tr, Allocator *allocr) { ev->typer = tr; ev->enabled = true; ev->allocr = allocr; - ffmgr_create(&ev->ffmgr); -} - -static void evalr_free(Evaluator *ev) { - ffmgr_free(&ev->ffmgr); + ffmgr_create(&ev->ffmgr, ev->allocr); } static inline void *evalr_malloc(Evaluator *ev, size_t bytes) { @@ -264,8 +264,8 @@ static bool arg_list_add(av_alist *arg_list, Value *val, Type *type, Location wh return true; } -static void ffmgr_create(ForeignFnManager *ffmgr) { - str_hash_table_create(&ffmgr->libs_loaded, sizeof(Library), NULL); +static void ffmgr_create(ForeignFnManager *ffmgr, Allocator *allocr) { + str_hash_table_create(&ffmgr->libs_loaded, sizeof(Library), allocr); } static bool foreign_call(ForeignFnManager *ffmgr, FnExpr *fn, Type *fn_type, Value *args, Location call_where, Value *ret) { @@ -315,16 +315,6 @@ static bool foreign_call(ForeignFnManager *ffmgr, FnExpr *fn, Type *fn_type, Val return true; } -static void ffmgr_free(ForeignFnManager *ffmgr) { - arr_foreach(ffmgr->libs_loaded.slots, StrHashTableSlotPtr, slotp) { - if (*slotp) { - Library *lib = (void *)((*slotp)->data); - dlclose(lib->handle); - } - } - str_hash_table_free(&ffmgr->libs_loaded); -} - #else static void ffmgr_create(ForeignFnManager *ffmgr) { (void)ffmgr; @@ -336,8 +326,5 @@ static bool foreign_call(ForeignFnManager *ffmgr, FnExpr *fn, Type *fn_type, Val return false; } -static void ffmgr_free(ForeignFnManager *ffmgr) { - (void)ffmgr; -} #endif @@ -18,10 +18,7 @@ /* TODO: -big leak check with tuples (see "TODO: tuples allocated here will never be freed!") -just make the ffmgr use the allocr ---- -iterating over an array of arrays (make sure you do a leak check) +change the way arrays work (a := b, where b is an array probably shouldn't copy) struct parameters - to allow circular dependencies in types foo, _ := bar(); nice syntax for #including something into a namespace @@ -140,7 +137,6 @@ int main(int argc, char **argv) { } allocr_free_all(&main_allocr); - evalr_free(&ev); fclose(out); return 0; } |