mie: implement value cleanup
This commit is contained in:
23
mie/func.c
23
mie/func.c
@@ -86,7 +86,30 @@ static struct mie_type *get_type(struct mie_value *v)
|
||||
return f->f_ret;
|
||||
}
|
||||
|
||||
static void cleanup(struct mie_value *value)
|
||||
{
|
||||
struct mie_func *func = MIE_FUNC(value);
|
||||
|
||||
b_queue_iterator it;
|
||||
b_queue_iterator_begin(&func->f_args, &it);
|
||||
while (b_queue_iterator_is_valid(&it)) {
|
||||
struct mie_value *v = b_unbox(struct mie_value, it.entry, v_entry);
|
||||
b_queue_iterator_erase(&it);
|
||||
mie_value_destroy(v);
|
||||
}
|
||||
|
||||
b_queue_iterator_begin(&func->f_blocks, &it);
|
||||
while (b_queue_iterator_is_valid(&it)) {
|
||||
struct mie_value *v = b_unbox(struct mie_value, it.entry, v_entry);
|
||||
b_queue_iterator_erase(&it);
|
||||
mie_value_destroy(v);
|
||||
}
|
||||
|
||||
mie_name_map_destroy(func->f_names);
|
||||
}
|
||||
|
||||
const struct mie_value_type func_value_type = {
|
||||
.t_id = MIE_VALUE_FUNC,
|
||||
.t_get_type = get_type,
|
||||
.t_cleanup = cleanup,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user