Exemple #1
0
void ty_teardown()
{
    hst_free(&name_table);

    hst_for_each(&typedef_table, ty_struct_def_free, NULL);
    hst_free(&typedef_table);

    hst_for_each(&enum_table, ty_method_free, NULL);
    hst_free(&enum_table);

    hst_for_each(&struct_table, ty_struct_def_free, NULL);
    hst_free(&struct_table);

    hst_for_each(&types_table, ty_struct_def_free, NULL);
    hst_free(&types_table);
    hst_free(&counted_table);

    hst_free(&enum_named_table);

    hst_for_each(&method_table, ty_method_free, NULL);
    hst_free(&method_table);
    hst_free(&init_table);
    hst_free(&generic_ident_table);

    hst_free(&interface_table);

    hst_free(&type_named_table);

    pool_drain(&list_mempool);
    pool_drain(&type_mempool);

    indirect_struct_type = NULL;
    generator_type = NULL;
}
void vs_free(VarScopeStack *vs)
{
    pool_drain(&vs->pool);

    hst_for_each(&vs->modules, &vs_modules_free_each, NULL);
    hst_free(&vs->modules);
}
/// Free object pool
void pool_free(pool * p) {
	if (p) {
		pool_drain(p);

		stack_free(p->allocated);

		free(p);
	}
}