#include <stdlib.h>
#include <babeltrace/values.h>
+#include <babeltrace/private-values.h>
#include <babeltrace/common-internal.h>
#include "babeltrace-cfg.h"
#include "babeltrace-cfg-cli-args-connect.h"
struct bt_config_component *comp = g_ptr_array_index(comps, i);
if (strcmp(name, comp->instance_name->str) == 0) {
- found_comp = bt_get(comp);
+ found_comp = bt_object_get_ref(comp);
goto end;
}
}
struct bt_config_component *comp;
comp = find_component(cfg, connection->upstream_comp_name->str);
- bt_put(comp);
+ bt_object_put_ref(comp);
if (!comp) {
snprintf(error_buf, error_buf_size,
"Invalid connection: cannot find upstream component `%s`:\n %s\n",
}
comp = find_component(cfg, connection->downstream_comp_name->str);
- bt_put(comp);
+ bt_object_put_ref(comp);
if (!comp) {
snprintf(error_buf, error_buf_size,
"Invalid connection: cannot find downstream component `%s`:\n %s\n",
goto end;
}
- BT_PUT(src_comp);
- BT_PUT(dst_comp);
+ BT_OBJECT_PUT_REF_AND_RESET(src_comp);
+ BT_OBJECT_PUT_REF_AND_RESET(dst_comp);
}
end:
- bt_put(src_comp);
- bt_put(dst_comp);
+ bt_object_put_ref(src_comp);
+ bt_object_put_ref(dst_comp);
return ret;
}
{
size_t i;
int ret = 0;
- struct bt_value *connected_components = bt_value_map_create();
+ struct bt_private_value *connected_components =
+ bt_private_value_map_create();
if (!connected_components) {
ret = -1;
struct bt_config_connection *connection =
g_ptr_array_index(cfg->cmd_data.run.connections, i);
- ret = bt_value_map_insert_entry(connected_components,
+ ret = bt_private_value_map_insert_entry(connected_components,
connection->upstream_comp_name->str, bt_value_null);
if (ret) {
goto end;
}
- ret = bt_value_map_insert_entry(connected_components,
+ ret = bt_private_value_map_insert_entry(connected_components,
connection->downstream_comp_name->str, bt_value_null);
if (ret) {
goto end;
}
ret = validate_all_components_connected_in_array(
- cfg->cmd_data.run.sources, connected_components,
+ cfg->cmd_data.run.sources,
+ bt_value_borrow_from_private(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,
+ bt_value_borrow_from_private(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,
+ bt_value_borrow_from_private(connected_components),
error_buf, error_buf_size);
if (ret) {
goto end;
}
end:
- bt_put(connected_components);
+ bt_object_put_ref(connected_components);
return ret;
}
{
size_t i;
int ret = 0;
- struct bt_value *flat_connection_names = bt_value_map_create();
+ struct bt_private_value *flat_connection_names =
+ bt_private_value_map_create();
GString *flat_connection_name = NULL;
if (!flat_connection_names) {
connection->downstream_comp_name->str,
connection->downstream_port_glob->str);
- if (bt_value_map_has_entry(flat_connection_names,
+ if (bt_value_map_has_entry(bt_value_borrow_from_private(
+ flat_connection_names),
flat_connection_name->str)) {
snprintf(error_buf, error_buf_size,
"Duplicate connection:\n %s\n",
goto end;
}
- ret = bt_value_map_insert_entry(flat_connection_names,
+ ret = bt_private_value_map_insert_entry(flat_connection_names,
flat_connection_name->str, bt_value_null);
if (ret) {
goto end;
}
end:
- bt_put(flat_connection_names);
+ bt_object_put_ref(flat_connection_names);
if (flat_connection_name) {
g_string_free(flat_connection_name, TRUE);