Add free function for freeing the custom structs.
This commit is contained in:
13
src/custom.c
Normal file
13
src/custom.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "custom.h"
|
||||
|
||||
void libab_behavior_free(libab_behavior* behavior) {
|
||||
libab_parsetype_free_recursive(behavior->type);
|
||||
}
|
||||
|
||||
void libab_operator_free(libab_operator* op) {
|
||||
libab_behavior_free(&op->behavior);
|
||||
}
|
||||
|
||||
void libab_function_free(libab_function* fun) {
|
||||
libab_behavior_free(&fun->behavior);
|
||||
}
|
||||
@@ -69,8 +69,8 @@ void libab_table_free(libab_table* table) {
|
||||
}
|
||||
void libab_table_entry_free(libab_table_entry* entry) {
|
||||
if(entry->variant == ENTRY_OP) {
|
||||
libab_parsetype_free_recursive(entry->data_u.op.behavior.type);
|
||||
libab_operator_free(&entry->data_u.op);
|
||||
} else if(entry->variant == ENTRY_FUN) {
|
||||
libab_parsetype_free_recursive(entry->data_u.function.behavior.type);
|
||||
libab_function_free(&entry->data_u.function);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user