diff --git a/include/custom.h b/include/custom.h index df2f5c8..46a756d 100644 --- a/include/custom.h +++ b/include/custom.h @@ -27,9 +27,10 @@ enum libab_operator_variant_e { enum libab_behavior_variant_e { BIMPL_INTERNAL, BIMPL_TREE }; /** - * A struct that represents the implementation of a behavior. + * The common information + * that both operators and functions shared. */ -struct libab_behavior_impl_s { +struct libab_behavior_s { /** * The variant of this implementation. */ @@ -46,16 +47,6 @@ struct libab_behavior_impl_s { } data_u; }; -/** - * The common information - * that both operators and functions shared. - */ -struct libab_behavior_s { - /** - * The implementation of this behavior. - */ - struct libab_behavior_impl_s impl; -}; /** * A struct that holds informatiion * about an operator that has been @@ -100,7 +91,6 @@ struct libab_function_s { typedef enum libab_operator_variant_e libab_operator_variant; typedef enum libab_behavior_variant_e libab_behavior_variant; -typedef struct libab_behavior_impl_s libab_behavior_impl; typedef struct libab_behavior_s libab_behavior; typedef struct libab_operator_s libab_operator; typedef struct libab_function_s libab_function; diff --git a/src/custom.c b/src/custom.c index cdf241f..7240fc0 100644 --- a/src/custom.c +++ b/src/custom.c @@ -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); } } diff --git a/src/libabacus.c b/src/libabacus.c index be81384..a234a23 100644 --- a/src/libabacus.c +++ b/src/libabacus.c @@ -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,