X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=cli%2Fbabeltrace-cfg-cli-args-connect.c;h=ff3bf91701fb3c125f5d990688243c3c500ce88e;hb=b19ff26f04df428047676dd736bd7cc9473906fe;hp=fc692391110ab14f6411aeaaa682038ba9737002;hpb=65300d60e4b4f167e5fc8f584677757ce09a3844;p=babeltrace.git diff --git a/cli/babeltrace-cfg-cli-args-connect.c b/cli/babeltrace-cfg-cli-args-connect.c index fc692391..ff3bf917 100644 --- a/cli/babeltrace-cfg-cli-args-connect.c +++ b/cli/babeltrace-cfg-cli-args-connect.c @@ -21,7 +21,7 @@ */ #include -#include +#include #include #include "babeltrace-cfg.h" #include "babeltrace-cfg-cli-args-connect.h" @@ -295,7 +295,8 @@ static struct bt_config_component *find_component_in_array(GPtrArray *comps, struct bt_config_component *comp = g_ptr_array_index(comps, i); if (strcmp(name, comp->instance_name->str) == 0) { - found_comp = bt_object_get_ref(comp); + found_comp = comp; + bt_object_get_ref(found_comp); goto end; } } @@ -506,7 +507,7 @@ end: } static int validate_all_components_connected_in_array(GPtrArray *comps, - struct bt_value *connected_components, + const bt_value *connected_components, char *error_buf, size_t error_buf_size) { int ret = 0; @@ -534,7 +535,7 @@ static int validate_all_components_connected(struct bt_config *cfg, { size_t i; int ret = 0; - struct bt_value *connected_components = bt_value_map_create(); + bt_value *connected_components = bt_value_map_create(); if (!connected_components) { ret = -1; @@ -559,28 +560,31 @@ static int validate_all_components_connected(struct bt_config *cfg, } ret = validate_all_components_connected_in_array( - cfg->cmd_data.run.sources, connected_components, + cfg->cmd_data.run.sources, + connected_components, error_buf, error_buf_size); if (ret) { goto end; } ret = validate_all_components_connected_in_array( - cfg->cmd_data.run.filters, connected_components, + cfg->cmd_data.run.filters, + connected_components, error_buf, error_buf_size); if (ret) { goto end; } ret = validate_all_components_connected_in_array( - cfg->cmd_data.run.sinks, connected_components, + cfg->cmd_data.run.sinks, + connected_components, error_buf, error_buf_size); if (ret) { goto end; } end: - bt_object_put_ref(connected_components); + bt_value_put_ref(connected_components); return ret; } @@ -589,7 +593,8 @@ static int validate_no_duplicate_connection(struct bt_config *cfg, { size_t i; int ret = 0; - struct bt_value *flat_connection_names = bt_value_map_create(); + bt_value *flat_connection_names = + bt_value_map_create(); GString *flat_connection_name = NULL; if (!flat_connection_names) { @@ -614,7 +619,7 @@ static int validate_no_duplicate_connection(struct bt_config *cfg, connection->downstream_port_glob->str); if (bt_value_map_has_entry(flat_connection_names, - flat_connection_name->str)) { + flat_connection_name->str)) { snprintf(error_buf, error_buf_size, "Duplicate connection:\n %s\n", connection->arg->str); @@ -630,7 +635,7 @@ static int validate_no_duplicate_connection(struct bt_config *cfg, } end: - bt_object_put_ref(flat_connection_names); + bt_value_put_ref(flat_connection_names); if (flat_connection_name) { g_string_free(flat_connection_name, TRUE); @@ -674,7 +679,7 @@ end: } int bt_config_cli_args_create_connections(struct bt_config *cfg, - struct bt_value *connection_args, + const bt_value *connection_args, char *error_buf, size_t error_buf_size) { int ret; @@ -687,14 +692,13 @@ int bt_config_cli_args_create_connections(struct bt_config *cfg, } for (i = 0; i < bt_value_array_get_size(connection_args); i++) { - struct bt_value *arg_value = - bt_value_array_borrow_element_by_index( + const bt_value *arg_value = + bt_value_array_borrow_element_by_index_const( connection_args, i); const char *arg; struct bt_config_connection *cfg_connection; - ret = bt_value_string_get(arg_value, &arg); - BT_ASSERT(ret == 0); + arg = bt_value_string_get(arg_value); cfg_connection = cfg_connection_from_arg(arg); if (!cfg_connection) { snprintf(error_buf, error_buf_size, "Cannot parse --connect option's argument:\n %s\n",