Increment refcount for tree when added to function.
This commit is contained in:
parent
39dd07b134
commit
3fc90383a9
|
@ -9,6 +9,7 @@ void libab_behavior_init_internal(libab_behavior* behavior,
|
|||
void libab_behavior_init_tree(libab_behavior* behavior, libab_tree* tree) {
|
||||
behavior->variant = BIMPL_TREE;
|
||||
behavior->data_u.tree = tree;
|
||||
tree->int_value++;
|
||||
}
|
||||
|
||||
void libab_behavior_copy(libab_behavior* behavior, libab_behavior* into) {
|
||||
|
@ -42,6 +43,7 @@ libab_result libab_function_init_internal(libab_function* function,
|
|||
libab_function_ptr fun,
|
||||
libab_ref* scope) {
|
||||
libab_result result = _function_init(function, scope);
|
||||
if(result == LIBAB_SUCCESS)
|
||||
libab_behavior_init_internal(&function->behavior, fun);
|
||||
return result;
|
||||
}
|
||||
|
@ -49,6 +51,7 @@ libab_result libab_function_init_tree(libab_function* function,
|
|||
libab_tree* tree,
|
||||
libab_ref* scope) {
|
||||
libab_result result = _function_init(function, scope);
|
||||
if(result == LIBAB_SUCCESS)
|
||||
libab_behavior_init_tree(&function->behavior, tree);
|
||||
return result;
|
||||
}
|
||||
|
@ -56,6 +59,7 @@ libab_result libab_function_init_behavior(libab_function* function,
|
|||
libab_behavior* behavior,
|
||||
libab_ref* scope) {
|
||||
libab_result result = _function_init(function, scope);
|
||||
if(result == LIBAB_SUCCESS)
|
||||
libab_behavior_copy(behavior, &function->behavior);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user