From: Philippe Proulx Date: Thu, 25 May 2017 07:12:30 +0000 (-0400) Subject: Remove component's initialization state flag X-Git-Tag: v2.0.0-pre1~186 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=a30f57f50a8b40992333eca763623d3a5c8bb199 Remove component's initialization state flag This "initializing" flag is now useless. It was used to make sure that only the implementation side of a component could set the component's private user data. This is now enforced by typing (component vs. private component), and it is always okay to set a private component's user data. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/include/babeltrace/graph/component-internal.h b/include/babeltrace/graph/component-internal.h index 29ff325b..d9fae8f0 100644 --- a/include/babeltrace/graph/component-internal.h +++ b/include/babeltrace/graph/component-internal.h @@ -58,12 +58,6 @@ struct bt_component { /* User-defined data */ void *user_data; - /* - * Used to protect operations which may only be used during - * a component's initialization. - */ - bt_bool initializing; - /* Input and output ports (weak references) */ GPtrArray *input_ports; GPtrArray *output_ports; diff --git a/lib/graph/component.c b/lib/graph/component.c index 4ea9bd86..7a5c382a 100644 --- a/lib/graph/component.c +++ b/lib/graph/component.c @@ -336,8 +336,6 @@ struct bt_component *bt_component_create_with_init_method_data( goto end; } - component->initializing = BT_TRUE; - if (component_class->methods.init) { BT_LOGD_STR("Calling user's initialization method."); ret = component_class->methods.init( @@ -345,7 +343,6 @@ struct bt_component *bt_component_create_with_init_method_data( init_method_data); BT_LOGD("User method returned: status=%s", bt_component_status_string(ret)); - component->initializing = BT_FALSE; if (ret != BT_COMPONENT_STATUS_OK) { BT_LOGW_STR("Initialization method failed."); BT_PUT(component); @@ -353,7 +350,6 @@ struct bt_component *bt_component_create_with_init_method_data( } } - component->initializing = BT_FALSE; ret = component_validation_funcs[type](component); if (ret != BT_COMPONENT_STATUS_OK) { BT_LOGW("Component is invalid: status=%s", @@ -428,11 +424,6 @@ enum bt_component_status bt_private_component_set_user_data( goto end; } - if (!component->initializing) { - ret = BT_COMPONENT_STATUS_INVALID; - goto end; - } - component->user_data = data; BT_LOGV("Set component's user data: " "comp-addr=%p, comp-name=\"%s\", user-data-addr=%p",