Remove unused nesting in behavior struct.

This commit is contained in:
2018-05-16 23:10:33 -07:00
parent 325c9b9ef7
commit 97543a3d19
3 changed files with 11 additions and 21 deletions

View File

@@ -2,19 +2,19 @@
void libab_behavior_init_internal(libab_behavior* behavior,
libab_function_ptr func) {
behavior->impl.variant = BIMPL_INTERNAL;
behavior->impl.data_u.internal = func;
behavior->variant = BIMPL_INTERNAL;
behavior->data_u.internal = func;
}
void libab_behavior_init_tree(libab_behavior* behavior,
libab_tree* tree) {
behavior->impl.variant = BIMPL_TREE;
behavior->impl.data_u.tree = tree;
behavior->variant = BIMPL_TREE;
behavior->data_u.tree = tree;
}
void libab_behavior_free(libab_behavior* behavior) {
if (behavior->impl.variant == BIMPL_TREE) {
libab_tree_free_recursive(behavior->impl.data_u.tree);
if (behavior->variant == BIMPL_TREE) {
libab_tree_free_recursive(behavior->data_u.tree);
}
}

View File

@@ -93,8 +93,8 @@ void _sanitize(char* to, const char* from, size_t buffer_size) {
void _initialize_behavior(libab_behavior* behavior, libab_ref* type,
libab_function_ptr func) {
behavior->impl.variant = BIMPL_INTERNAL;
behavior->impl.data_u.internal = func;
behavior->variant = BIMPL_INTERNAL;
behavior->data_u.internal = func;
}
libab_result _register_operator(libab* ab, const char* op,