aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/vector.h2
-rw-r--r--src/data.c2
-rw-r--r--src/lang.c10
-rw-r--r--src/program.c4
4 files changed, 8 insertions, 10 deletions
diff --git a/include/vector.h b/include/vector.h
index 79422c9c..e0b73286 100644
--- a/include/vector.h
+++ b/include/vector.h
@@ -65,10 +65,10 @@ typedef enum BcDtorType {
#if !BC_ENABLE_LIBRARY
#ifndef NDEBUG
BC_DTOR_ID,
+ BC_DTOR_FUNC,
#endif // NDEBUG
BC_DTOR_SLAB,
BC_DTOR_CONST,
- BC_DTOR_FUNC,
BC_DTOR_RESULT,
#if BC_ENABLE_HISTORY
BC_DTOR_HISTORY_STRING,
diff --git a/src/data.c b/src/data.c
index 00b40272..df594ce4 100644
--- a/src/data.c
+++ b/src/data.c
@@ -241,10 +241,10 @@ const BcVecFree bc_vec_dtors[] = {
#if !BC_ENABLE_LIBRARY
#ifndef NDEBUG
bc_id_free,
+ bc_func_free,
#endif // NDEBUG
bc_slab_free,
bc_const_free,
- bc_func_free,
bc_result_free,
#if BC_ENABLE_HISTORY
bc_history_string_free,
diff --git a/src/lang.c b/src/lang.c
index d1eda2b4..098d7f5f 100644
--- a/src/lang.c
+++ b/src/lang.c
@@ -130,10 +130,9 @@ void bc_func_reset(BcFunc *f) {
#endif // BC_ENABLED
}
+#ifndef NDEBUG
void bc_func_free(void *func) {
-#if BC_ENABLE_FUNC_FREE
-
BcFunc *f = (BcFunc*) func;
BC_SIG_ASSERT_LOCKED;
@@ -144,7 +143,6 @@ void bc_func_free(void *func) {
bc_vec_free(&f->consts);
#if BC_ENABLED
-#ifndef NDEBUG
if (BC_IS_BC) {
bc_vec_free(&f->strs);
@@ -152,13 +150,9 @@ void bc_func_free(void *func) {
bc_vec_free(&f->autos);
bc_vec_free(&f->labels);
}
-#endif // NDEBUG
#endif // BC_ENABLED
-
-#else // BC_ENABLE_FUNC_FREE
- BC_UNUSED(func);
-#endif // BC_ENABLE_FUNC_FREE
}
+#endif // NDEBUG
void bc_array_init(BcVec *a, bool nums) {
BC_SIG_ASSERT_LOCKED;
diff --git a/src/program.c b/src/program.c
index 09a082c0..9444afef 100644
--- a/src/program.c
+++ b/src/program.c
@@ -1802,7 +1802,11 @@ void bc_program_init(BcProgram *p) {
if (BC_IS_BC) bc_num_init(&p->last, BC_NUM_DEF_SIZE);
#endif // BC_ENABLED
+#ifndef NDEBUG
bc_vec_init(&p->fns, sizeof(BcFunc), BC_DTOR_FUNC);
+#else // NDEBUG
+ bc_vec_init(&p->fns, sizeof(BcFunc), BC_DTOR_NONE);
+#endif // NDEBUG
bc_map_init(&p->fn_map);
bc_program_insertFunc(p, bc_func_main);
bc_program_insertFunc(p, bc_func_read);