diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-07-20 00:12:08 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-07-30 00:41:56 +0200 |
commit | c441f65c19e62eefaa8af37ae74ae47c4d4eaa4e (patch) | |
tree | cecea2c2870311d7abc4c741bb1b38a5dc1ca454 /types.c | |
parent | 23224687205076604c1e0e5829690a5b6e150c06 (diff) |
program: add infrastructure to handle multiple sources per program
The upcoming module support requires maintaining multiple source objects
within the same program, so add the necessary infrastructure for it.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'types.c')
-rw-r--r-- | types.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -191,8 +191,8 @@ ucv_gc_mark(uc_value_t *uv) case UC_PROGRAM: program = (uc_program_t *)uv; - if (program->source) - ucv_gc_mark(&program->source->header); + for (i = 0; i < program->sources.count; i++) + ucv_gc_mark(&program->sources.entries[i]->header); break; @@ -283,7 +283,11 @@ ucv_free(uc_value_t *uv, bool retain) uc_program_function_free(func); uc_vallist_free(&program->constants); - ucv_put_value(&program->source->header, retain); + + for (i = 0; i < program->sources.count; i++) + ucv_put_value(&program->sources.entries[i]->header, retain); + + uc_vector_clear(&program->sources); break; case UC_SOURCE: |