From 707b7d3548cc010d582f7faed43630aed26508fd Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 30 Nov 2018 16:42:13 -0500 Subject: [PATCH] lib: rename transforming bt_X_borrow_Y() -> bt_X_as_Y() We're not borrowing anything, we're just converting the type. Signed-off-by: Philippe Proulx --- cli/babeltrace-cfg-cli-args-connect.c | 8 +- cli/babeltrace-cfg-cli-args.c | 52 +++--- cli/babeltrace.c | 70 ++++---- .../babeltrace/graph/component-class-filter.h | 2 +- .../babeltrace/graph/component-class-sink.h | 2 +- .../babeltrace/graph/component-class-source.h | 2 +- include/babeltrace/graph/component-filter.h | 2 +- include/babeltrace/graph/component-sink.h | 2 +- include/babeltrace/graph/component-source.h | 2 +- include/babeltrace/graph/port-input.h | 2 +- .../graph/port-output-notification-iterator.h | 2 +- include/babeltrace/graph/port-output.h | 2 +- .../graph/private-component-class-filter.h | 4 +- .../graph/private-component-class-sink.h | 4 +- .../graph/private-component-class-source.h | 4 +- .../graph/private-component-class.h | 2 +- include/babeltrace/graph/private-graph.h | 2 +- .../babeltrace/graph/private-notification.h | 2 +- .../babeltrace/graph/private-query-executor.h | 2 +- .../graph/self-component-class-filter.h | 2 +- .../graph/self-component-class-sink.h | 2 +- .../graph/self-component-class-source.h | 2 +- .../babeltrace/graph/self-component-filter.h | 4 +- ...mponent-port-input-notification-iterator.h | 2 +- .../graph/self-component-port-input.h | 4 +- .../graph/self-component-port-output.h | 4 +- .../babeltrace/graph/self-component-port.h | 2 +- .../babeltrace/graph/self-component-sink.h | 4 +- .../babeltrace/graph/self-component-source.h | 4 +- include/babeltrace/graph/self-component.h | 2 +- include/babeltrace/private-values.h | 2 +- .../babeltrace/trace-ir/private-clock-class.h | 2 +- .../babeltrace/trace-ir/private-event-class.h | 2 +- include/babeltrace/trace-ir/private-event.h | 2 +- .../trace-ir/private-field-classes.h | 2 +- include/babeltrace/trace-ir/private-fields.h | 2 +- include/babeltrace/trace-ir/private-packet.h | 2 +- .../trace-ir/private-stream-class.h | 2 +- include/babeltrace/trace-ir/private-stream.h | 2 +- include/babeltrace/trace-ir/private-trace.h | 2 +- lib/ctf-writer/attributes.c | 26 +-- lib/ctf-writer/trace.c | 14 +- lib/graph/component-class-sink-colander.c | 10 +- lib/graph/graph.c | 2 +- lib/plugin/plugin-so.c | 6 +- lib/trace-ir/attributes.c | 26 +-- lib/trace-ir/trace.c | 6 +- .../ctf/common/metadata/ctf-meta-translate.c | 2 +- .../ctf-meta-update-default-clock-classes.c | 4 +- plugins/ctf/common/metadata/ctf-meta.h | 2 +- .../ctf/common/metadata/visitor-generate-ir.c | 10 +- plugins/ctf/common/notif-iter/notif-iter.c | 28 +-- plugins/ctf/fs-src/data-stream-file.c | 2 +- plugins/ctf/fs-src/fs.c | 18 +- plugins/ctf/fs-src/query.c | 16 +- plugins/text/dmesg/dmesg.c | 12 +- plugins/text/pretty/pretty.c | 10 +- plugins/utils/counter/counter.c | 8 +- plugins/utils/dummy/dummy.c | 8 +- plugins/utils/muxer/muxer.c | 42 ++--- tests/lib/test-plugin-plugins/sfs.c | 2 +- tests/lib/test_bt_notification_iterator.c | 50 +++--- tests/lib/test_bt_values.c | 160 +++++++++--------- tests/lib/test_graph_topo.c | 146 ++++++++-------- tests/lib/test_plugin.c | 8 +- 65 files changed, 419 insertions(+), 419 deletions(-) diff --git a/cli/babeltrace-cfg-cli-args-connect.c b/cli/babeltrace-cfg-cli-args-connect.c index 8e941e21..c22fe6ad 100644 --- a/cli/babeltrace-cfg-cli-args-connect.c +++ b/cli/babeltrace-cfg-cli-args-connect.c @@ -562,7 +562,7 @@ static int validate_all_components_connected(struct bt_config *cfg, ret = validate_all_components_connected_in_array( cfg->cmd_data.run.sources, - bt_private_value_borrow_value(connected_components), + bt_private_value_as_value(connected_components), error_buf, error_buf_size); if (ret) { goto end; @@ -570,7 +570,7 @@ static int validate_all_components_connected(struct bt_config *cfg, ret = validate_all_components_connected_in_array( cfg->cmd_data.run.filters, - bt_private_value_borrow_value(connected_components), + bt_private_value_as_value(connected_components), error_buf, error_buf_size); if (ret) { goto end; @@ -578,7 +578,7 @@ static int validate_all_components_connected(struct bt_config *cfg, ret = validate_all_components_connected_in_array( cfg->cmd_data.run.sinks, - bt_private_value_borrow_value(connected_components), + bt_private_value_as_value(connected_components), error_buf, error_buf_size); if (ret) { goto end; @@ -619,7 +619,7 @@ static int validate_no_duplicate_connection(struct bt_config *cfg, connection->downstream_comp_name->str, connection->downstream_port_glob->str); - if (bt_value_map_has_entry(bt_private_value_borrow_value( + if (bt_value_map_has_entry(bt_private_value_as_value( flat_connection_names), flat_connection_name->str)) { snprintf(error_buf, error_buf_size, diff --git a/cli/babeltrace-cfg-cli-args.c b/cli/babeltrace-cfg-cli-args.c index 76eb9c00..80802fbe 100644 --- a/cli/babeltrace-cfg-cli-args.c +++ b/cli/babeltrace-cfg-cli-args.c @@ -243,7 +243,7 @@ int ini_handle_state(struct ini_parsing_state *state) } if (bt_value_map_has_entry( - bt_private_value_borrow_value(state->params), + bt_private_value_as_value(state->params), state->last_map_key)) { g_string_append_printf(state->ini_error, "Duplicate parameter key: `%s`\n", @@ -295,20 +295,20 @@ int ini_handle_state(struct ini_parsing_state *state) goto error; } - value = bt_private_value_borrow_value( + value = bt_private_value_as_value( bt_private_value_integer_create_init( (int64_t) int_val)); break; } case G_TOKEN_FLOAT: /* Positive floating point number */ - value = bt_private_value_borrow_value( + value = bt_private_value_as_value( bt_private_value_real_create_init( state->scanner->value.v_float)); break; case G_TOKEN_STRING: /* Quoted string */ - value = bt_private_value_borrow_value( + value = bt_private_value_as_value( bt_private_value_string_create_init( state->scanner->value.v_string)); break; @@ -332,16 +332,16 @@ int ini_handle_state(struct ini_parsing_state *state) } else if (!strcmp(id, "true") || !strcmp(id, "TRUE") || !strcmp(id, "yes") || !strcmp(id, "YES")) { - value = bt_private_value_borrow_value( + value = bt_private_value_as_value( bt_private_value_bool_create_init(true)); } else if (!strcmp(id, "false") || !strcmp(id, "FALSE") || !strcmp(id, "no") || !strcmp(id, "NO")) { - value = bt_private_value_borrow_value( + value = bt_private_value_as_value( bt_private_value_bool_create_init(false)); } else { - value = bt_private_value_borrow_value( + value = bt_private_value_as_value( bt_private_value_string_create_init(id)); } break; @@ -375,14 +375,14 @@ int ini_handle_state(struct ini_parsing_state *state) goto error; } - value = bt_private_value_borrow_value( + value = bt_private_value_as_value( bt_private_value_integer_create_init( -((int64_t) int_val))); break; } case G_TOKEN_FLOAT: /* Negative floating point number */ - value = bt_private_value_borrow_value( + value = bt_private_value_as_value( bt_private_value_real_create_init( -state->scanner->value.v_float)); break; @@ -1404,7 +1404,7 @@ int add_run_cfg_comp_check_name(struct bt_config *cfg, goto end; } - if (bt_value_map_has_entry(bt_private_value_borrow_value(instance_names), + if (bt_value_map_has_entry(bt_private_value_as_value(instance_names), cfg_comp->instance_name->str)) { printf_err("Duplicate component instance name:\n %s\n", cfg_comp->instance_name->str); @@ -2517,7 +2517,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[], bt_object_put_ref(cur_cfg_comp->params); status = bt_value_copy( &cur_cfg_comp->params, - bt_private_value_borrow_value(cur_base_params)); + bt_private_value_as_value(cur_base_params)); if (status != BT_VALUE_STATUS_OK) { print_err_oom(); goto error; @@ -2545,8 +2545,8 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[], } status = bt_value_map_extend(¶ms_to_set, - bt_private_value_borrow_value(cur_cfg_comp->params), - bt_private_value_borrow_value(params)); + bt_private_value_as_value(cur_cfg_comp->params), + bt_private_value_as_value(params)); BT_OBJECT_PUT_REF_AND_RESET(params); if (status != BT_VALUE_STATUS_OK) { printf_err("Cannot extend current component parameters with --params option's argument:\n %s\n", @@ -2685,7 +2685,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[], } ret = bt_config_cli_args_create_connections(cfg, - bt_private_value_borrow_value(connection_args), + bt_private_value_as_value(connection_args), error_buf, 256); if (ret) { printf_err("Cannot creation connections:\n%s", error_buf); @@ -2984,7 +2984,7 @@ int assign_name_to_implicit_component(struct implicit_component_args *args, } name = get_component_auto_name(prefix, - bt_private_value_borrow_value(existing_names)); + bt_private_value_as_value(existing_names)); if (!name) { ret = -1; @@ -3059,13 +3059,13 @@ int append_run_args_for_implicit_component( } for (i = 0; i < bt_value_array_get_size( - bt_private_value_borrow_value(impl_args->extra_params)); + bt_private_value_as_value(impl_args->extra_params)); i++) { struct bt_value *elem; const char *arg; elem = bt_value_array_borrow_element_by_index( - bt_private_value_borrow_value(impl_args->extra_params), + bt_private_value_as_value(impl_args->extra_params), i); if (!elem) { goto error; @@ -3213,7 +3213,7 @@ int convert_append_name_param(enum bt_config_component_dest dest, * component. */ name = get_component_auto_name(cur_name_prefix->str, - bt_private_value_borrow_value(all_names)); + bt_private_value_as_value(all_names)); append_name_opt = true; } else { /* @@ -3221,7 +3221,7 @@ int convert_append_name_param(enum bt_config_component_dest dest, * component. */ if (bt_value_map_has_entry( - bt_private_value_borrow_value(all_names), + bt_private_value_as_value(all_names), cur_name->str)) { printf_err("Duplicate component instance name:\n %s\n", cur_name->str); @@ -3558,7 +3558,7 @@ int fill_implicit_ctf_inputs_args(GPtrArray *implicit_ctf_inputs_args, */ BT_OBJECT_PUT_REF_AND_RESET(impl_args->extra_params); status = bt_value_copy(&impl_args->extra_params, - bt_private_value_borrow_value( + bt_private_value_as_value( base_implicit_ctf_input_args->extra_params)); if (status != BT_VALUE_STATUS_OK) { print_err_oom(); @@ -4178,7 +4178,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], implicit_text_args.exists = true; ret = insert_flat_params_from_array( implicit_text_args.params_arg, - bt_private_value_borrow_value(fields), "field"); + bt_private_value_as_value(fields), "field"); bt_object_put_ref(fields); if (ret) { goto error; @@ -4196,7 +4196,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], implicit_text_args.exists = true; ret = insert_flat_params_from_array( implicit_text_args.params_arg, - bt_private_value_borrow_value(names), "name"); + bt_private_value_as_value(names), "name"); bt_object_put_ref(names); if (ret) { goto error; @@ -4687,10 +4687,10 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], } for (i = 0; i < bt_value_array_get_size( - bt_private_value_borrow_value(run_args)); i++) { + bt_private_value_as_value(run_args)); i++) { struct bt_value *arg_value = bt_value_array_borrow_element_by_index( - bt_private_value_borrow_value(run_args), + bt_private_value_as_value(run_args), i); const char *arg; GString *quoted = NULL; @@ -4717,7 +4717,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], } if (i < bt_value_array_get_size( - bt_private_value_borrow_value(run_args)) - 1) { + bt_private_value_as_value(run_args)) - 1) { if (print_run_args) { putchar(' '); } else { @@ -4732,7 +4732,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], } cfg = bt_config_run_from_args_array( - bt_private_value_borrow_value(run_args), retcode, + bt_private_value_as_value(run_args), retcode, force_omit_system_plugin_path, force_omit_home_plugin_path, initial_plugin_paths); if (!cfg) { diff --git a/cli/babeltrace.c b/cli/babeltrace.c index c6daa07a..29a54a58 100644 --- a/cli/babeltrace.c +++ b/cli/babeltrace.c @@ -210,7 +210,7 @@ int query(struct bt_component_class *comp_cls, const char *obj, if (usleep(sleep_time_us)) { if (bt_query_executor_is_canceled( - bt_private_query_executor_borrow_query_executor(the_query_executor))) { + bt_private_query_executor_as_query_executor(the_query_executor))) { BT_LOGI("Query was canceled by user: " "comp-cls-addr=%p, comp-cls-name=\"%s\", " "query-obj=\"%s\"", comp_cls, @@ -362,17 +362,17 @@ struct bt_component_class *find_component_class(const char *plugin_name, switch (comp_class_type) { case BT_COMPONENT_CLASS_TYPE_SOURCE: - comp_cls = bt_component_class_source_borrow_component_class( + comp_cls = bt_component_class_source_as_component_class( find_source_component_class(plugin_name, comp_class_name)); break; case BT_COMPONENT_CLASS_TYPE_FILTER: - comp_cls = bt_component_class_filter_borrow_component_class( + comp_cls = bt_component_class_filter_as_component_class( find_filter_component_class(plugin_name, comp_class_name)); break; case BT_COMPONENT_CLASS_TYPE_SINK: - comp_cls = bt_component_class_sink_borrow_component_class( + comp_cls = bt_component_class_sink_as_component_class( find_sink_component_class(plugin_name, comp_class_name)); break; @@ -627,7 +627,7 @@ void print_bt_config_component(struct bt_config_component *bt_config_component) fprintf(stderr, " Parameters:\n"); print_value(stderr, - bt_private_value_borrow_value(bt_config_component->params), 8); + bt_private_value_as_value(bt_config_component->params), 8); } static @@ -655,7 +655,7 @@ void print_cfg_run(struct bt_config *cfg) { size_t i; - print_plugin_paths(bt_private_value_borrow_value(cfg->plugin_paths)); + print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths)); fprintf(stderr, " Source component instances:\n"); print_bt_config_components(cfg->cmd_data.run.sources); @@ -686,19 +686,19 @@ void print_cfg_run(struct bt_config *cfg) static void print_cfg_list_plugins(struct bt_config *cfg) { - print_plugin_paths(bt_private_value_borrow_value(cfg->plugin_paths)); + print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths)); } static void print_cfg_help(struct bt_config *cfg) { - print_plugin_paths(bt_private_value_borrow_value(cfg->plugin_paths)); + print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths)); } static void print_cfg_print_ctf_metadata(struct bt_config *cfg) { - print_plugin_paths(bt_private_value_borrow_value(cfg->plugin_paths)); + print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths)); fprintf(stderr, " Path: %s\n", cfg->cmd_data.print_ctf_metadata.path->str); } @@ -706,7 +706,7 @@ void print_cfg_print_ctf_metadata(struct bt_config *cfg) static void print_cfg_print_lttng_live_sessions(struct bt_config *cfg) { - print_plugin_paths(bt_private_value_borrow_value(cfg->plugin_paths)); + print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths)); fprintf(stderr, " URL: %s\n", cfg->cmd_data.print_lttng_live_sessions.url->str); } @@ -714,7 +714,7 @@ void print_cfg_print_lttng_live_sessions(struct bt_config *cfg) static void print_cfg_query(struct bt_config *cfg) { - print_plugin_paths(bt_private_value_borrow_value(cfg->plugin_paths)); + print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths)); fprintf(stderr, " Object: `%s`\n", cfg->cmd_data.query.object->str); fprintf(stderr, " Component class:\n"); print_bt_config_component(cfg->cmd_data.query.cfg_component); @@ -961,7 +961,7 @@ int cmd_query(struct bt_config *cfg) } ret = query(comp_cls, cfg->cmd_data.query.object->str, - bt_private_value_borrow_value( + bt_private_value_as_value( cfg->cmd_data.query.cfg_component->params), &results, &fail_reason); if (ret) { @@ -1155,7 +1155,7 @@ int cmd_list_plugins(struct bt_config *cfg) int plugins_count, component_classes_count = 0, i; printf("From the following plugin paths:\n\n"); - print_value(stdout, bt_private_value_borrow_value(cfg->plugin_paths), 2); + print_value(stdout, bt_private_value_as_value(cfg->plugin_paths), 2); printf("\n"); plugins_count = loaded_plugins->len; if (plugins_count == 0) { @@ -1190,19 +1190,19 @@ int cmd_list_plugins(struct bt_config *cfg) (plugin_borrow_comp_cls_by_index_func_t) bt_plugin_borrow_source_component_class_by_name, (spec_comp_cls_borrow_comp_cls_func_t) - bt_component_class_source_borrow_component_class); + bt_component_class_source_as_component_class); cmd_list_plugins_print_component_classes(plugin, "Filter", bt_plugin_get_filter_component_class_count(plugin), (plugin_borrow_comp_cls_by_index_func_t) bt_plugin_borrow_filter_component_class_by_name, (spec_comp_cls_borrow_comp_cls_func_t) - bt_component_class_filter_borrow_component_class); + bt_component_class_filter_as_component_class); cmd_list_plugins_print_component_classes(plugin, "Sink", bt_plugin_get_sink_component_class_count(plugin), (plugin_borrow_comp_cls_by_index_func_t) bt_plugin_borrow_sink_component_class_by_name, (spec_comp_cls_borrow_comp_cls_func_t) - bt_component_class_sink_borrow_component_class); + bt_component_class_sink_as_component_class); } end: @@ -1255,7 +1255,7 @@ int cmd_print_lttng_live_sessions(struct bt_config *cfg) goto error; } - ret = query(comp_cls, "sessions", bt_private_value_borrow_value(params), + ret = query(comp_cls, "sessions", bt_private_value_as_value(params), &results, &fail_reason); if (ret) { goto failed; @@ -1410,7 +1410,7 @@ int cmd_print_ctf_metadata(struct bt_config *cfg) } ret = query(comp_cls, "metadata-info", - bt_private_value_borrow_value(params), &results, &fail_reason); + bt_private_value_as_value(params), &results, &fail_reason); if (ret) { goto failed; } @@ -1601,7 +1601,7 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component( typedef struct bt_port_input *(*borrow_input_port_by_index_func_t)( void *, uint64_t); struct bt_port *upstream_port = - bt_port_output_borrow_port(out_upstream_port); + bt_port_output_as_port(out_upstream_port); int ret = 0; GQuark downstreamp_comp_name_quark; @@ -1713,7 +1713,7 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component( struct bt_port_input *in_downstream_port = port_by_index_fn(downstream_comp, i); struct bt_port *downstream_port = - bt_port_input_borrow_port(in_downstream_port); + bt_port_input_as_port(in_downstream_port); const char *upstream_port_name; const char *downstream_port_name; @@ -1769,7 +1769,7 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component( ctx->connect_ports = false; graph_status = bt_private_graph_add_filter_component( ctx->graph, trimmer_class, trimmer_name, - bt_private_value_borrow_value(trimmer_params), + bt_private_value_as_value(trimmer_params), &trimmer); free(trimmer_name); if (graph_status != BT_GRAPH_STATUS_OK) { @@ -1796,7 +1796,7 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component( */ in_downstream_port = trimmer_input; downstream_port = - bt_port_input_borrow_port(in_downstream_port); + bt_port_input_as_port(in_downstream_port); downstream_port_name = bt_port_get_name( downstream_port); BT_ASSERT(downstream_port_name); @@ -1871,7 +1871,7 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component( */ ret = cmd_run_ctx_connect_upstream_port_to_downstream_component( ctx, - bt_component_filter_borrow_component(trimmer), + bt_component_filter_as_component(trimmer), trimmer_output, cfg_conn); if (ret) { goto error; @@ -1922,10 +1922,10 @@ int cmd_run_ctx_connect_upstream_port(struct cmd_run_ctx *ctx, BT_ASSERT(ctx); BT_ASSERT(upstream_port); upstream_port_name = bt_port_get_name( - bt_port_output_borrow_port(upstream_port)); + bt_port_output_as_port(upstream_port)); BT_ASSERT(upstream_port_name); upstream_comp = bt_port_borrow_component( - bt_port_output_borrow_port(upstream_port)); + bt_port_output_as_port(upstream_port)); if (!upstream_comp) { BT_LOGW("Upstream port to connect is not part of a component: " "port-addr=%p, port-name=\"%s\"", @@ -1993,7 +1993,7 @@ void graph_output_port_added_listener(struct cmd_run_ctx *ctx, struct bt_port_output *out_port) { struct bt_component *comp; - struct bt_port *port = bt_port_output_borrow_port(out_port); + struct bt_port *port = bt_port_output_as_port(out_port); comp = bt_port_borrow_component(port); BT_LOGI("Port added to a graph's component: comp-addr=%p, " @@ -2165,10 +2165,10 @@ int set_stream_intersections(struct cmd_run_ctx *ctx, struct trace_range *trace_range = NULL; const char *fail_reason = NULL; struct bt_component_class *comp_cls = - bt_component_class_source_borrow_component_class(src_comp_cls); + bt_component_class_source_as_component_class(src_comp_cls); component_path_value = bt_value_map_borrow_entry_value( - bt_private_value_borrow_value(cfg_comp->params), + bt_private_value_as_value(cfg_comp->params), "path"); if (component_path_value && !bt_value_is_string(component_path_value)) { BT_LOGD("Cannot get path parameter: component-name=%s", @@ -2194,7 +2194,7 @@ int set_stream_intersections(struct cmd_run_ctx *ctx, } ret = query(comp_cls, "trace-info", - bt_private_value_borrow_value(query_params), &query_result, + bt_private_value_as_value(query_params), &query_result, &fail_reason); if (ret) { BT_LOGD("Component class does not support the `trace-info` query: %s: " @@ -2435,19 +2435,19 @@ int cmd_run_ctx_create_components_from_config_components( case BT_COMPONENT_CLASS_TYPE_SOURCE: ret = bt_private_graph_add_source_component(ctx->graph, comp_cls, cfg_comp->instance_name->str, - bt_private_value_borrow_value(cfg_comp->params), + bt_private_value_as_value(cfg_comp->params), (void *) &comp); break; case BT_COMPONENT_CLASS_TYPE_FILTER: ret = bt_private_graph_add_filter_component(ctx->graph, comp_cls, cfg_comp->instance_name->str, - bt_private_value_borrow_value(cfg_comp->params), + bt_private_value_as_value(cfg_comp->params), (void *) &comp); break; case BT_COMPONENT_CLASS_TYPE_SINK: ret = bt_private_graph_add_sink_component(ctx->graph, comp_cls, cfg_comp->instance_name->str, - bt_private_value_borrow_value(cfg_comp->params), + bt_private_value_as_value(cfg_comp->params), (void *) &comp); break; default: @@ -2715,7 +2715,7 @@ int cmd_run(struct bt_config *cfg) goto error; case BT_GRAPH_STATUS_AGAIN: if (bt_graph_is_canceled( - bt_private_graph_borrow_graph(ctx.graph))) { + bt_private_graph_as_graph(ctx.graph))) { BT_LOGI_STR("Graph was canceled by user."); goto error; } @@ -2727,7 +2727,7 @@ int cmd_run(struct bt_config *cfg) if (usleep(cfg->cmd_data.run.retry_duration_us)) { if (bt_graph_is_canceled( - bt_private_graph_borrow_graph(ctx.graph))) { + bt_private_graph_as_graph(ctx.graph))) { BT_LOGI_STR("Graph was canceled by user."); goto error; } @@ -2950,7 +2950,7 @@ int main(int argc, const char **argv) if (cfg->command_needs_plugins) { ret = load_all_plugins( - bt_private_value_borrow_value(cfg->plugin_paths)); + bt_private_value_as_value(cfg->plugin_paths)); if (ret) { BT_LOGE("Failed to load plugins: ret=%d", ret); retcode = 1; diff --git a/include/babeltrace/graph/component-class-filter.h b/include/babeltrace/graph/component-class-filter.h index beddfa10..83365be3 100644 --- a/include/babeltrace/graph/component-class-filter.h +++ b/include/babeltrace/graph/component-class-filter.h @@ -32,7 +32,7 @@ struct bt_component_class_filter; static inline struct bt_component_class * -bt_component_class_filter_borrow_component_class( +bt_component_class_filter_as_component_class( struct bt_component_class_filter *comp_cls_filter) { return (void *) comp_cls_filter; diff --git a/include/babeltrace/graph/component-class-sink.h b/include/babeltrace/graph/component-class-sink.h index 45e70139..db28fe83 100644 --- a/include/babeltrace/graph/component-class-sink.h +++ b/include/babeltrace/graph/component-class-sink.h @@ -32,7 +32,7 @@ struct bt_component_class_sink; static inline struct bt_component_class * -bt_component_class_sink_borrow_component_class( +bt_component_class_sink_as_component_class( struct bt_component_class_sink *comp_cls_sink) { return (void *) comp_cls_sink; diff --git a/include/babeltrace/graph/component-class-source.h b/include/babeltrace/graph/component-class-source.h index 5bf1f178..8e24e9c0 100644 --- a/include/babeltrace/graph/component-class-source.h +++ b/include/babeltrace/graph/component-class-source.h @@ -32,7 +32,7 @@ struct bt_component_class_source; static inline struct bt_component_class * -bt_component_class_source_borrow_component_class( +bt_component_class_source_as_component_class( struct bt_component_class_source *comp_cls_source) { return (void *) comp_cls_source; diff --git a/include/babeltrace/graph/component-filter.h b/include/babeltrace/graph/component-filter.h index ebc55387..89238f28 100644 --- a/include/babeltrace/graph/component-filter.h +++ b/include/babeltrace/graph/component-filter.h @@ -37,7 +37,7 @@ struct bt_port_input; struct bt_port_output; static inline -struct bt_component *bt_component_filter_borrow_component( +struct bt_component *bt_component_filter_as_component( struct bt_component_filter *component) { return (void *) component; diff --git a/include/babeltrace/graph/component-sink.h b/include/babeltrace/graph/component-sink.h index 6c33eb75..12fe73d4 100644 --- a/include/babeltrace/graph/component-sink.h +++ b/include/babeltrace/graph/component-sink.h @@ -36,7 +36,7 @@ struct bt_component_sink; struct bt_port_input; static inline -struct bt_component *bt_component_sink_borrow_component( +struct bt_component *bt_component_sink_as_component( struct bt_component_sink *component) { return (void *) component; diff --git a/include/babeltrace/graph/component-source.h b/include/babeltrace/graph/component-source.h index 91af914b..cfdd41fe 100644 --- a/include/babeltrace/graph/component-source.h +++ b/include/babeltrace/graph/component-source.h @@ -36,7 +36,7 @@ struct bt_component_source; struct bt_port_output; static inline -struct bt_component *bt_component_source_borrow_component( +struct bt_component *bt_component_source_as_component( struct bt_component_source *component) { return (void *) component; diff --git a/include/babeltrace/graph/port-input.h b/include/babeltrace/graph/port-input.h index b57e15df..9e55f828 100644 --- a/include/babeltrace/graph/port-input.h +++ b/include/babeltrace/graph/port-input.h @@ -35,7 +35,7 @@ struct bt_port; struct bt_port_input; static inline -struct bt_port *bt_port_input_borrow_port(struct bt_port_input *port_input) +struct bt_port *bt_port_input_as_port(struct bt_port_input *port_input) { return (void *) port_input; } diff --git a/include/babeltrace/graph/port-output-notification-iterator.h b/include/babeltrace/graph/port-output-notification-iterator.h index 2dd0bf22..a271a212 100644 --- a/include/babeltrace/graph/port-output-notification-iterator.h +++ b/include/babeltrace/graph/port-output-notification-iterator.h @@ -44,7 +44,7 @@ struct bt_port_output; static inline struct bt_notification_iterator * -bt_port_output_notification_iterator_borrow_notification_iterator( +bt_port_output_notification_iterator_as_notification_iterator( struct bt_port_output_notification_iterator *iterator) { return (void *) iterator; diff --git a/include/babeltrace/graph/port-output.h b/include/babeltrace/graph/port-output.h index f27310d9..986abb94 100644 --- a/include/babeltrace/graph/port-output.h +++ b/include/babeltrace/graph/port-output.h @@ -35,7 +35,7 @@ struct bt_port; struct bt_port_output; static inline -struct bt_port *bt_port_output_borrow_port(struct bt_port_output *port_output) +struct bt_port *bt_port_output_as_port(struct bt_port_output *port_output) { return (void *) port_output; } diff --git a/include/babeltrace/graph/private-component-class-filter.h b/include/babeltrace/graph/private-component-class-filter.h index 663fad64..3830a50c 100644 --- a/include/babeltrace/graph/private-component-class-filter.h +++ b/include/babeltrace/graph/private-component-class-filter.h @@ -123,7 +123,7 @@ typedef void static inline struct bt_private_component_class * -bt_private_component_class_filter_borrow_private_component_class( +bt_private_component_class_filter_as_private_component_class( struct bt_private_component_class_filter *priv_comp_cls_filter) { return (void *) priv_comp_cls_filter; @@ -131,7 +131,7 @@ bt_private_component_class_filter_borrow_private_component_class( static inline struct bt_component_class_filter * -bt_private_component_class_filter_borrow_component_class_filter( +bt_private_component_class_filter_as_component_class_filter( struct bt_private_component_class_filter *priv_comp_cls_filter) { return (void *) priv_comp_cls_filter; diff --git a/include/babeltrace/graph/private-component-class-sink.h b/include/babeltrace/graph/private-component-class-sink.h index f29701e5..9a1b7151 100644 --- a/include/babeltrace/graph/private-component-class-sink.h +++ b/include/babeltrace/graph/private-component-class-sink.h @@ -89,7 +89,7 @@ typedef enum bt_self_component_status static inline struct bt_private_component_class * -bt_private_component_class_sink_borrow_private_component_class( +bt_private_component_class_sink_as_private_component_class( struct bt_private_component_class_sink *priv_comp_cls_sink) { return (void *) priv_comp_cls_sink; @@ -97,7 +97,7 @@ bt_private_component_class_sink_borrow_private_component_class( static inline struct bt_component_class_sink * -bt_private_component_class_sink_borrow_component_class_sink( +bt_private_component_class_sink_as_component_class_sink( struct bt_private_component_class_sink *priv_comp_cls_sink) { return (void *) priv_comp_cls_sink; diff --git a/include/babeltrace/graph/private-component-class-source.h b/include/babeltrace/graph/private-component-class-source.h index 9c89c9b1..3238a623 100644 --- a/include/babeltrace/graph/private-component-class-source.h +++ b/include/babeltrace/graph/private-component-class-source.h @@ -104,7 +104,7 @@ typedef void static inline struct bt_private_component_class * -bt_private_component_class_source_borrow_private_component_class( +bt_private_component_class_source_as_private_component_class( struct bt_private_component_class_source *priv_comp_cls_source) { return (void *) priv_comp_cls_source; @@ -112,7 +112,7 @@ bt_private_component_class_source_borrow_private_component_class( static inline struct bt_component_class_source * -bt_private_component_class_source_borrow_component_class_source( +bt_private_component_class_source_as_component_class_source( struct bt_private_component_class_source *priv_comp_cls_source) { return (void *) priv_comp_cls_source; diff --git a/include/babeltrace/graph/private-component-class.h b/include/babeltrace/graph/private-component-class.h index a39a6b1f..c8a76305 100644 --- a/include/babeltrace/graph/private-component-class.h +++ b/include/babeltrace/graph/private-component-class.h @@ -35,7 +35,7 @@ struct bt_private_component_class; static inline struct bt_component_class * -bt_private_component_class_borrow_component_class( +bt_private_component_class_as_component_class( struct bt_private_component_class *priv_comp_cls) { return (void *) priv_comp_cls; diff --git a/include/babeltrace/graph/private-graph.h b/include/babeltrace/graph/private-graph.h index 08c31c55..542304c1 100644 --- a/include/babeltrace/graph/private-graph.h +++ b/include/babeltrace/graph/private-graph.h @@ -121,7 +121,7 @@ typedef void (*bt_private_graph_filter_sink_component_ports_disconnected_listene typedef void (* bt_private_graph_listener_removed)(void *data); static inline -struct bt_graph *bt_private_graph_borrow_graph(struct bt_private_graph *graph) +struct bt_graph *bt_private_graph_as_graph(struct bt_private_graph *graph) { return (void *) graph; } diff --git a/include/babeltrace/graph/private-notification.h b/include/babeltrace/graph/private-notification.h index 72b3840b..3833d632 100644 --- a/include/babeltrace/graph/private-notification.h +++ b/include/babeltrace/graph/private-notification.h @@ -33,7 +33,7 @@ struct bt_notification; struct bt_private_notification; static inline -struct bt_notification *bt_private_notification_borrow_notification( +struct bt_notification *bt_private_notification_as_notification( struct bt_private_notification *notification) { return (void *) notification; diff --git a/include/babeltrace/graph/private-query-executor.h b/include/babeltrace/graph/private-query-executor.h index e2cbceb3..2eeb48a3 100644 --- a/include/babeltrace/graph/private-query-executor.h +++ b/include/babeltrace/graph/private-query-executor.h @@ -36,7 +36,7 @@ struct bt_component_class; struct bt_value; static inline -struct bt_query_executor *bt_private_query_executor_borrow_query_executor( +struct bt_query_executor *bt_private_query_executor_as_query_executor( struct bt_private_query_executor *priv_query_executor) { return (void *) priv_query_executor; diff --git a/include/babeltrace/graph/self-component-class-filter.h b/include/babeltrace/graph/self-component-class-filter.h index d1a447cd..8a029a8d 100644 --- a/include/babeltrace/graph/self-component-class-filter.h +++ b/include/babeltrace/graph/self-component-class-filter.h @@ -32,7 +32,7 @@ struct bt_self_component_class_filter; static inline struct bt_component_class_filter * -bt_self_component_class_filter_borrow_component_class_filter( +bt_self_component_class_filter_as_component_class_filter( struct bt_self_component_class_filter *self_comp_cls_filter) { return (void *) self_comp_cls_filter; diff --git a/include/babeltrace/graph/self-component-class-sink.h b/include/babeltrace/graph/self-component-class-sink.h index d3ab8377..01dacaa3 100644 --- a/include/babeltrace/graph/self-component-class-sink.h +++ b/include/babeltrace/graph/self-component-class-sink.h @@ -32,7 +32,7 @@ struct bt_self_component_class_sink; static inline struct bt_component_class_sink * -bt_self_component_class_sink_borrow_component_class_sink( +bt_self_component_class_sink_as_component_class_sink( struct bt_self_component_class_sink *self_comp_cls_sink) { return (void *) self_comp_cls_sink; diff --git a/include/babeltrace/graph/self-component-class-source.h b/include/babeltrace/graph/self-component-class-source.h index 6cb41949..0cdbc866 100644 --- a/include/babeltrace/graph/self-component-class-source.h +++ b/include/babeltrace/graph/self-component-class-source.h @@ -32,7 +32,7 @@ struct bt_self_component_class_source; static inline struct bt_component_class_source * -bt_self_component_class_source_borrow_component_class_source( +bt_self_component_class_source_as_component_class_source( struct bt_self_component_class_source *self_comp_cls_source) { return (void *) self_comp_cls_source; diff --git a/include/babeltrace/graph/self-component-filter.h b/include/babeltrace/graph/self-component-filter.h index ad23cdee..4aef3ccc 100644 --- a/include/babeltrace/graph/self-component-filter.h +++ b/include/babeltrace/graph/self-component-filter.h @@ -39,7 +39,7 @@ struct bt_self_component_port_input; struct bt_self_component_port_output; static inline -struct bt_self_component *bt_self_component_filter_borrow_self_component( +struct bt_self_component *bt_self_component_filter_as_self_component( struct bt_self_component_filter *self_comp_filter) { return (void *) self_comp_filter; @@ -47,7 +47,7 @@ struct bt_self_component *bt_self_component_filter_borrow_self_component( static inline struct bt_component_filter * -bt_self_component_filter_borrow_component_filter( +bt_self_component_filter_as_component_filter( struct bt_self_component_filter *self_comp_filter) { return (void *) self_comp_filter; diff --git a/include/babeltrace/graph/self-component-port-input-notification-iterator.h b/include/babeltrace/graph/self-component-port-input-notification-iterator.h index 5bfb7104..fd7e02fc 100644 --- a/include/babeltrace/graph/self-component-port-input-notification-iterator.h +++ b/include/babeltrace/graph/self-component-port-input-notification-iterator.h @@ -42,7 +42,7 @@ struct bt_self_component_port_input; static inline struct bt_notification_iterator * -bt_self_component_port_input_notification_iterator_borrow_notification_iterator( +bt_self_component_port_input_notification_iterator_as_notification_iterator( struct bt_self_component_port_input_notification_iterator *iterator) { return (void *) iterator; diff --git a/include/babeltrace/graph/self-component-port-input.h b/include/babeltrace/graph/self-component-port-input.h index a133059f..d25e1144 100644 --- a/include/babeltrace/graph/self-component-port-input.h +++ b/include/babeltrace/graph/self-component-port-input.h @@ -36,14 +36,14 @@ struct bt_self_component_port_input; static inline struct bt_self_component_port * -bt_self_component_port_input_borrow_self_component_port( +bt_self_component_port_input_as_self_component_port( struct bt_self_component_port_input *self_component_port) { return (void *) self_component_port; } static inline -struct bt_port_input *bt_self_component_port_input_borrow_port_input( +struct bt_port_input *bt_self_component_port_input_as_port_input( struct bt_self_component_port_input *self_component_port) { return (void *) self_component_port; diff --git a/include/babeltrace/graph/self-component-port-output.h b/include/babeltrace/graph/self-component-port-output.h index eaf5d912..6857f3e8 100644 --- a/include/babeltrace/graph/self-component-port-output.h +++ b/include/babeltrace/graph/self-component-port-output.h @@ -36,14 +36,14 @@ struct bt_self_component_port_output; static inline struct bt_self_component_port * -bt_self_component_port_output_borrow_self_component_port( +bt_self_component_port_output_as_self_component_port( struct bt_self_component_port_output *self_component_port) { return (void *) self_component_port; } static inline -struct bt_port_output *bt_self_component_port_output_borrow_port_output( +struct bt_port_output *bt_self_component_port_output_as_port_output( struct bt_self_component_port_output *self_component_port) { return (void *) self_component_port; diff --git a/include/babeltrace/graph/self-component-port.h b/include/babeltrace/graph/self-component-port.h index f8866b1b..9eaacf1e 100644 --- a/include/babeltrace/graph/self-component-port.h +++ b/include/babeltrace/graph/self-component-port.h @@ -37,7 +37,7 @@ enum bt_self_component_port_status { }; static inline -struct bt_port *bt_self_component_port_borrow_port( +struct bt_port *bt_self_component_port_as_port( struct bt_self_component_port *self_port) { return (void *) self_port; diff --git a/include/babeltrace/graph/self-component-sink.h b/include/babeltrace/graph/self-component-sink.h index b98e764b..bdb76c8a 100644 --- a/include/babeltrace/graph/self-component-sink.h +++ b/include/babeltrace/graph/self-component-sink.h @@ -38,7 +38,7 @@ struct bt_self_component_sink; struct bt_self_component_port_input; static inline -struct bt_self_component *bt_self_component_sink_borrow_self_component( +struct bt_self_component *bt_self_component_sink_as_self_component( struct bt_self_component_sink *self_comp_sink) { return (void *) self_comp_sink; @@ -46,7 +46,7 @@ struct bt_self_component *bt_self_component_sink_borrow_self_component( static inline struct bt_component_sink * -bt_self_component_sink_borrow_component_sink( +bt_self_component_sink_as_component_sink( struct bt_self_component_sink *self_comp_sink) { return (void *) self_comp_sink; diff --git a/include/babeltrace/graph/self-component-source.h b/include/babeltrace/graph/self-component-source.h index 61bacd19..95ccdb7a 100644 --- a/include/babeltrace/graph/self-component-source.h +++ b/include/babeltrace/graph/self-component-source.h @@ -38,7 +38,7 @@ struct bt_self_component_source; struct bt_self_component_port_output; static inline -struct bt_self_component *bt_self_component_source_borrow_self_component( +struct bt_self_component *bt_self_component_source_as_self_component( struct bt_self_component_source *self_comp_source) { return (void *) self_comp_source; @@ -46,7 +46,7 @@ struct bt_self_component *bt_self_component_source_borrow_self_component( static inline struct bt_component_source * -bt_self_component_source_borrow_component_source( +bt_self_component_source_as_component_source( struct bt_self_component_source *self_comp_source) { return (void *) self_comp_source; diff --git a/include/babeltrace/graph/self-component.h b/include/babeltrace/graph/self-component.h index db2a8a8d..b5d8f551 100644 --- a/include/babeltrace/graph/self-component.h +++ b/include/babeltrace/graph/self-component.h @@ -40,7 +40,7 @@ enum bt_self_component_status { }; static inline -struct bt_component *bt_self_component_borrow_component( +struct bt_component *bt_self_component_as_component( struct bt_self_component *self_component) { return (void *) self_component; diff --git a/include/babeltrace/private-values.h b/include/babeltrace/private-values.h index b747b3d7..a6ebc68d 100644 --- a/include/babeltrace/private-values.h +++ b/include/babeltrace/private-values.h @@ -40,7 +40,7 @@ struct bt_private_value; extern struct bt_private_value *bt_private_value_null; static inline -struct bt_value *bt_private_value_borrow_value( +struct bt_value *bt_private_value_as_value( struct bt_private_value *priv_value) { return (void *) priv_value; diff --git a/include/babeltrace/trace-ir/private-clock-class.h b/include/babeltrace/trace-ir/private-clock-class.h index 39a2b485..20f54c42 100644 --- a/include/babeltrace/trace-ir/private-clock-class.h +++ b/include/babeltrace/trace-ir/private-clock-class.h @@ -42,7 +42,7 @@ struct bt_clock_class; struct bt_private_clock_class; static inline -struct bt_clock_class *bt_private_clock_class_borrow_clock_class( +struct bt_clock_class *bt_private_clock_class_as_clock_class( struct bt_private_clock_class *priv_clock_class) { return (void *) priv_clock_class; diff --git a/include/babeltrace/trace-ir/private-event-class.h b/include/babeltrace/trace-ir/private-event-class.h index 16262456..5965137c 100644 --- a/include/babeltrace/trace-ir/private-event-class.h +++ b/include/babeltrace/trace-ir/private-event-class.h @@ -42,7 +42,7 @@ struct bt_private_event_class; struct bt_private_stream_class; static inline -struct bt_event_class *bt_private_event_class_borrow_event_class( +struct bt_event_class *bt_private_event_class_as_event_class( struct bt_private_event_class *priv_event_class) { return (void *) priv_event_class; diff --git a/include/babeltrace/trace-ir/private-event.h b/include/babeltrace/trace-ir/private-event.h index 1bb86491..dfa29c10 100644 --- a/include/babeltrace/trace-ir/private-event.h +++ b/include/babeltrace/trace-ir/private-event.h @@ -39,7 +39,7 @@ struct bt_private_field; struct bt_private_packet; static inline -struct bt_event *bt_private_event_borrow_event( +struct bt_event *bt_private_event_as_event( struct bt_private_event *priv_event) { return (void *) priv_event; diff --git a/include/babeltrace/trace-ir/private-field-classes.h b/include/babeltrace/trace-ir/private-field-classes.h index 6c6c56a2..017091ac 100644 --- a/include/babeltrace/trace-ir/private-field-classes.h +++ b/include/babeltrace/trace-ir/private-field-classes.h @@ -48,7 +48,7 @@ struct bt_private_field_class_signed_enumeration_mapping_ranges; struct bt_private_field_class_unsigned_enumeration_mapping_ranges; static inline -struct bt_field_class *bt_private_field_class_borrow_field_class( +struct bt_field_class *bt_private_field_class_as_field_class( struct bt_private_field_class *priv_field_class) { return (void *) priv_field_class; diff --git a/include/babeltrace/trace-ir/private-fields.h b/include/babeltrace/trace-ir/private-fields.h index 6199df01..1d98f7ac 100644 --- a/include/babeltrace/trace-ir/private-fields.h +++ b/include/babeltrace/trace-ir/private-fields.h @@ -39,7 +39,7 @@ struct bt_private_field; struct bt_private_field_class; static inline -struct bt_field *bt_private_field_borrow_field( +struct bt_field *bt_private_field_as_field( struct bt_private_field *priv_field) { return (void *) priv_field; diff --git a/include/babeltrace/trace-ir/private-packet.h b/include/babeltrace/trace-ir/private-packet.h index fa1c103d..febea34b 100644 --- a/include/babeltrace/trace-ir/private-packet.h +++ b/include/babeltrace/trace-ir/private-packet.h @@ -39,7 +39,7 @@ struct bt_private_packet_context_field; struct bt_private_stream; static inline -struct bt_packet *bt_private_packet_borrow_packet( +struct bt_packet *bt_private_packet_as_packet( struct bt_private_packet *priv_packet) { return (void *) priv_packet; diff --git a/include/babeltrace/trace-ir/private-stream-class.h b/include/babeltrace/trace-ir/private-stream-class.h index 1f34a7e6..78113db0 100644 --- a/include/babeltrace/trace-ir/private-stream-class.h +++ b/include/babeltrace/trace-ir/private-stream-class.h @@ -44,7 +44,7 @@ struct bt_private_event_class; struct bt_private_clock_class; static inline -struct bt_stream_class *bt_private_stream_class_borrow_stream_class( +struct bt_stream_class *bt_private_stream_class_as_stream_class( struct bt_private_stream_class *priv_stream_class) { return (void *) priv_stream_class; diff --git a/include/babeltrace/trace-ir/private-stream.h b/include/babeltrace/trace-ir/private-stream.h index 973e3908..a4e402e5 100644 --- a/include/babeltrace/trace-ir/private-stream.h +++ b/include/babeltrace/trace-ir/private-stream.h @@ -39,7 +39,7 @@ struct bt_private_stream; struct bt_private_stream_class; static inline -struct bt_stream *bt_private_stream_borrow_stream( +struct bt_stream *bt_private_stream_as_stream( struct bt_private_stream *priv_stream) { return (void *) priv_stream; diff --git a/include/babeltrace/trace-ir/private-trace.h b/include/babeltrace/trace-ir/private-trace.h index a121a3e9..8dfba8e8 100644 --- a/include/babeltrace/trace-ir/private-trace.h +++ b/include/babeltrace/trace-ir/private-trace.h @@ -52,7 +52,7 @@ typedef void (* bt_private_trace_listener_removed)( struct bt_private_trace *trace, void *data); static inline -struct bt_trace *bt_private_trace_borrow_trace( +struct bt_trace *bt_private_trace_as_trace( struct bt_private_trace *priv_trace) { return (void *) priv_trace; diff --git a/lib/ctf-writer/attributes.c b/lib/ctf-writer/attributes.c index 5b4529f0..cbaf29fb 100644 --- a/lib/ctf-writer/attributes.c +++ b/lib/ctf-writer/attributes.c @@ -81,7 +81,7 @@ void bt_ctf_attributes_destroy(struct bt_private_value *attr_obj) BT_HIDDEN int64_t bt_ctf_attributes_get_count(struct bt_private_value *attr_obj) { - return bt_value_array_get_size(bt_private_value_borrow_value(attr_obj)); + return bt_value_array_get_size(bt_private_value_as_value(attr_obj)); } BT_HIDDEN @@ -97,10 +97,10 @@ const char *bt_ctf_attributes_get_field_name(struct bt_private_value *attr_obj, goto end; } - if (index >= bt_value_array_get_size(bt_private_value_borrow_value(attr_obj))) { + if (index >= bt_value_array_get_size(bt_private_value_as_value(attr_obj))) { BT_LOGW("Invalid parameter: index is out of bounds: " "index=%" PRIu64 ", count=%" PRId64, - index, bt_value_array_get_size(bt_private_value_borrow_value(attr_obj))); + index, bt_value_array_get_size(bt_private_value_as_value(attr_obj))); goto end; } @@ -123,7 +123,7 @@ const char *bt_ctf_attributes_get_field_name(struct bt_private_value *attr_obj, } ret = bt_value_string_get( - bt_private_value_borrow_value(attr_field_name_obj)); + bt_private_value_as_value(attr_field_name_obj)); end: return ret; @@ -141,10 +141,10 @@ struct bt_private_value *bt_ctf_attributes_borrow_field_value(struct bt_private_ goto end; } - if (index >= bt_value_array_get_size(bt_private_value_borrow_value(attr_obj))) { + if (index >= bt_value_array_get_size(bt_private_value_as_value(attr_obj))) { BT_LOGW("Invalid parameter: index is out of bounds: " "index=%" PRIu64 ", count=%" PRId64, - index, bt_value_array_get_size(bt_private_value_borrow_value(attr_obj))); + index, bt_value_array_get_size(bt_private_value_as_value(attr_obj))); goto end; } @@ -177,7 +177,7 @@ struct bt_private_value *bt_ctf_attributes_borrow_field_by_name( struct bt_private_value *value_obj = NULL; struct bt_private_value *attr_field_name_obj = NULL; - attr_size = bt_value_array_get_size(bt_private_value_borrow_value(attr_obj)); + attr_size = bt_value_array_get_size(bt_private_value_as_value(attr_obj)); if (attr_size < 0) { BT_LOGE("Cannot get array value's size: value-addr=%p", attr_obj); @@ -204,7 +204,7 @@ struct bt_private_value *bt_ctf_attributes_borrow_field_by_name( } field_name = bt_value_string_get( - bt_private_value_borrow_value(attr_field_name_obj)); + bt_private_value_as_value(attr_field_name_obj)); if (!strcmp(field_name, name)) { break; @@ -239,7 +239,7 @@ int bt_ctf_attributes_set_field_value(struct bt_private_value *attr_obj, if (attr_field_obj) { ret = bt_private_value_array_set_element_by_index( attr_field_obj, BT_CTF_ATTR_VALUE_INDEX, - bt_private_value_borrow_value(value_obj)); + bt_private_value_as_value(value_obj)); attr_field_obj = NULL; goto end; } @@ -253,7 +253,7 @@ int bt_ctf_attributes_set_field_value(struct bt_private_value *attr_obj, ret = bt_private_value_array_append_string_element(attr_field_obj, name); ret |= bt_private_value_array_append_element(attr_field_obj, - bt_private_value_borrow_value(value_obj)); + bt_private_value_as_value(value_obj)); if (ret) { BT_LOGE("Cannot append elements to array value: addr=%p", attr_field_obj); @@ -261,7 +261,7 @@ int bt_ctf_attributes_set_field_value(struct bt_private_value *attr_obj, } ret = bt_private_value_array_append_element(attr_obj, - bt_private_value_borrow_value(attr_field_obj)); + bt_private_value_as_value(attr_field_obj)); if (ret) { BT_LOGE("Cannot append element to array value: " "array-value-addr=%p, element-value-addr=%p", @@ -319,7 +319,7 @@ int bt_ctf_attributes_freeze(struct bt_private_value *attr_obj) } BT_LOGD("Freezing attributes object: value-addr=%p", attr_obj); - count = bt_value_array_get_size(bt_private_value_borrow_value(attr_obj)); + count = bt_value_array_get_size(bt_private_value_as_value(attr_obj)); BT_ASSERT(count >= 0); /* @@ -339,7 +339,7 @@ int bt_ctf_attributes_freeze(struct bt_private_value *attr_obj) goto end; } - bt_value_freeze(bt_private_value_borrow_value(obj)); + bt_value_freeze(bt_private_value_as_value(obj)); } end: diff --git a/lib/ctf-writer/trace.c b/lib/ctf-writer/trace.c index fd04695c..b21ec0f0 100644 --- a/lib/ctf-writer/trace.c +++ b/lib/ctf-writer/trace.c @@ -261,15 +261,15 @@ int bt_ctf_trace_common_set_environment_field(struct bt_ctf_trace_common *trace, goto end; } - if (!bt_value_is_integer(bt_private_value_borrow_value(value)) && - !bt_value_is_string(bt_private_value_borrow_value(value))) { + if (!bt_value_is_integer(bt_private_value_as_value(value)) && + !bt_value_is_string(bt_private_value_as_value(value))) { BT_LOGW("Invalid parameter: environment field's value is not an integer or string value: " "trace-addr=%p, trace-name=\"%s\", " "env-name=\"%s\", env-value-type=%s", trace, bt_ctf_trace_common_get_name(trace), name, bt_common_value_type_string( bt_value_get_type( - bt_private_value_borrow_value(value)))); + bt_private_value_as_value(value)))); ret = -1; goto end; } @@ -294,7 +294,7 @@ int bt_ctf_trace_common_set_environment_field(struct bt_ctf_trace_common *trace, goto end; } - bt_value_freeze(bt_private_value_borrow_value(value)); + bt_value_freeze(bt_private_value_as_value(value)); } ret = bt_ctf_attributes_set_field_value(trace->environment, name, @@ -1760,13 +1760,13 @@ void append_env_metadata(struct bt_ctf_trace *trace, BT_ASSERT(env_field_value_obj); switch (bt_value_get_type( - bt_private_value_borrow_value(env_field_value_obj))) { + bt_private_value_as_value(env_field_value_obj))) { case BT_VALUE_TYPE_INTEGER: { int64_t int_value; int_value = bt_value_integer_get( - bt_private_value_borrow_value( + bt_private_value_as_value( env_field_value_obj)); g_string_append_printf(context->string, "\t%s = %" PRId64 ";\n", entry_name, @@ -1779,7 +1779,7 @@ void append_env_metadata(struct bt_ctf_trace *trace, char *escaped_str = NULL; str_value = bt_value_string_get( - bt_private_value_borrow_value( + bt_private_value_as_value( env_field_value_obj)); escaped_str = g_strescape(str_value, NULL); if (!escaped_str) { diff --git a/lib/graph/component-class-sink-colander.c b/lib/graph/component-class-sink-colander.c index a40f8ea0..712c4731 100644 --- a/lib/graph/component-class-sink-colander.c +++ b/lib/graph/component-class-sink-colander.c @@ -76,7 +76,7 @@ enum bt_self_component_status colander_init( } bt_self_component_set_data( - bt_self_component_sink_borrow_self_component(self_comp), + bt_self_component_sink_as_self_component(self_comp), colander_data); end: @@ -88,7 +88,7 @@ void colander_finalize(struct bt_self_component_sink *self_comp) { struct colander_data *colander_data = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(self_comp)); + bt_self_component_sink_as_self_component(self_comp)); if (!colander_data) { return; @@ -107,7 +107,7 @@ enum bt_self_component_status colander_input_port_connected( enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; struct colander_data *colander_data = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(self_comp)); + bt_self_component_sink_as_self_component(self_comp)); BT_ASSERT(colander_data); BT_OBJECT_PUT_REF_AND_RESET(colander_data->notif_iter); @@ -134,7 +134,7 @@ enum bt_self_component_status colander_consume( enum bt_notification_iterator_status notif_iter_status; struct colander_data *colander_data = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(self_comp)); + bt_self_component_sink_as_self_component(self_comp)); bt_notification_array notifs; BT_ASSERT(colander_data); @@ -196,7 +196,7 @@ struct bt_component_class_sink *bt_component_class_sink_colander_get(void) end: return bt_object_get_ref( - bt_private_component_class_sink_borrow_component_class_sink( + bt_private_component_class_sink_as_component_class_sink( colander_comp_cls)); } diff --git a/lib/graph/graph.c b/lib/graph/graph.c index 1b4653de..cc27a699 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -1705,7 +1705,7 @@ enum bt_graph_status add_component_with_init_method_data( graph, comp_cls, name, params, init_method_data); if (!params) { - params = bt_private_value_borrow_value( + params = bt_private_value_as_value( bt_private_value_map_create()); if (!params) { BT_LOGE_STR("Cannot create map value object."); diff --git a/lib/plugin/plugin-so.c b/lib/plugin/plugin-so.c index 357a4ccd..9208dc53 100644 --- a/lib/plugin/plugin-so.c +++ b/lib/plugin/plugin-so.c @@ -712,21 +712,21 @@ enum bt_plugin_status bt_plugin_so_init( src_comp_class = bt_private_component_class_source_create( cc_full_descr->descriptor->name, cc_full_descr->descriptor->methods.source.notif_iter_next); - comp_class = bt_private_component_class_source_borrow_private_component_class( + comp_class = bt_private_component_class_source_as_private_component_class( src_comp_class); break; case BT_COMPONENT_CLASS_TYPE_FILTER: flt_comp_class = bt_private_component_class_filter_create( cc_full_descr->descriptor->name, cc_full_descr->descriptor->methods.source.notif_iter_next); - comp_class = bt_private_component_class_filter_borrow_private_component_class( + comp_class = bt_private_component_class_filter_as_private_component_class( flt_comp_class); break; case BT_COMPONENT_CLASS_TYPE_SINK: sink_comp_class = bt_private_component_class_sink_create( cc_full_descr->descriptor->name, cc_full_descr->descriptor->methods.sink.consume); - comp_class = bt_private_component_class_sink_borrow_private_component_class( + comp_class = bt_private_component_class_sink_as_private_component_class( sink_comp_class); break; default: diff --git a/lib/trace-ir/attributes.c b/lib/trace-ir/attributes.c index 44068de2..b3867739 100644 --- a/lib/trace-ir/attributes.c +++ b/lib/trace-ir/attributes.c @@ -77,7 +77,7 @@ void bt_attributes_destroy(struct bt_private_value *attr_obj) BT_HIDDEN int64_t bt_attributes_get_count(struct bt_private_value *attr_obj) { - return bt_value_array_get_size(bt_private_value_borrow_value(attr_obj)); + return bt_value_array_get_size(bt_private_value_as_value(attr_obj)); } BT_HIDDEN @@ -94,11 +94,11 @@ const char *bt_attributes_get_field_name(struct bt_private_value *attr_obj, } if (index >= bt_value_array_get_size( - bt_private_value_borrow_value(attr_obj))) { + bt_private_value_as_value(attr_obj))) { BT_LOGW("Invalid parameter: index is out of bounds: " "index=%" PRIu64 ", count=%" PRId64, index, bt_value_array_get_size( - bt_private_value_borrow_value(attr_obj))); + bt_private_value_as_value(attr_obj))); goto end; } @@ -121,7 +121,7 @@ const char *bt_attributes_get_field_name(struct bt_private_value *attr_obj, } ret = bt_value_string_get( - bt_private_value_borrow_value(attr_field_name_obj)); + bt_private_value_as_value(attr_field_name_obj)); end: return ret; @@ -139,11 +139,11 @@ struct bt_private_value *bt_attributes_borrow_field_value( goto end; } - if (index >= bt_value_array_get_size(bt_private_value_borrow_value(attr_obj))) { + if (index >= bt_value_array_get_size(bt_private_value_as_value(attr_obj))) { BT_LOGW("Invalid parameter: index is out of bounds: " "index=%" PRIu64 ", count=%" PRId64, index, bt_value_array_get_size( - bt_private_value_borrow_value(attr_obj))); + bt_private_value_as_value(attr_obj))); goto end; } @@ -177,7 +177,7 @@ struct bt_private_value *bt_attributes_borrow_field_by_name( struct bt_private_value *attr_field_name_obj = NULL; attr_size = bt_value_array_get_size( - bt_private_value_borrow_value(attr_obj)); + bt_private_value_as_value(attr_obj)); if (attr_size < 0) { BT_LOGE("Cannot get array value's size: value-addr=%p", attr_obj); @@ -206,7 +206,7 @@ struct bt_private_value *bt_attributes_borrow_field_by_name( } field_name = bt_value_string_get( - bt_private_value_borrow_value(attr_field_name_obj)); + bt_private_value_as_value(attr_field_name_obj)); if (!strcmp(field_name, name)) { break; @@ -241,7 +241,7 @@ int bt_attributes_set_field_value(struct bt_private_value *attr_obj, if (attr_field_obj) { ret = bt_private_value_array_set_element_by_index( attr_field_obj, BT_ATTR_VALUE_INDEX, - bt_private_value_borrow_value(value_obj)); + bt_private_value_as_value(value_obj)); attr_field_obj = NULL; goto end; } @@ -256,7 +256,7 @@ int bt_attributes_set_field_value(struct bt_private_value *attr_obj, ret = bt_private_value_array_append_string_element(attr_field_obj, name); ret |= bt_private_value_array_append_element(attr_field_obj, - bt_private_value_borrow_value(value_obj)); + bt_private_value_as_value(value_obj)); if (ret) { BT_LOGE("Cannot append elements to array value: addr=%p", attr_field_obj); @@ -264,7 +264,7 @@ int bt_attributes_set_field_value(struct bt_private_value *attr_obj, } ret = bt_private_value_array_append_element(attr_obj, - bt_private_value_borrow_value(attr_field_obj)); + bt_private_value_as_value(attr_field_obj)); if (ret) { BT_LOGE("Cannot append element to array value: " "array-value-addr=%p, element-value-addr=%p", @@ -322,7 +322,7 @@ int bt_attributes_freeze(struct bt_private_value *attr_obj) } BT_LOGD("Freezing attributes object: value-addr=%p", attr_obj); - count = bt_value_array_get_size(bt_private_value_borrow_value(attr_obj)); + count = bt_value_array_get_size(bt_private_value_as_value(attr_obj)); BT_ASSERT(count >= 0); /* @@ -342,7 +342,7 @@ int bt_attributes_freeze(struct bt_private_value *attr_obj) goto end; } - bt_value_freeze(bt_private_value_borrow_value(obj)); + bt_value_freeze(bt_private_value_as_value(obj)); } end: diff --git a/lib/trace-ir/trace.c b/lib/trace-ir/trace.c index f5c66cb8..be791f36 100644 --- a/lib/trace-ir/trace.c +++ b/lib/trace-ir/trace.c @@ -274,7 +274,7 @@ int set_environment_entry(struct bt_trace *trace, const char *name, "%![trace-]+t, entry-name=\"%s\"", trace, name); ret = bt_attributes_set_field_value(trace->environment, name, value); - bt_value_freeze(bt_private_value_borrow_value(value)); + bt_value_freeze(bt_private_value_as_value(value)); if (ret) { BT_LIB_LOGE("Cannot set trace's environment entry: " "%![trace-]+t, entry-name=\"%s\"", trace, name); @@ -356,7 +356,7 @@ void bt_trace_borrow_environment_entry_by_index( BT_ASSERT_PRE_NON_NULL(value, "Value"); BT_ASSERT_PRE_VALID_INDEX(index, bt_attributes_get_count(trace->environment)); - *value = bt_private_value_borrow_value( + *value = bt_private_value_as_value( bt_attributes_borrow_field_value(trace->environment, index)); BT_ASSERT(*value); *name = bt_attributes_get_field_name(trace->environment, index); @@ -376,7 +376,7 @@ struct bt_value *bt_trace_borrow_environment_entry_value_by_name( { BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE_NON_NULL(name, "Name"); - return bt_private_value_borrow_value( + return bt_private_value_as_value( bt_attributes_borrow_field_value_by_name(trace->environment, name)); } diff --git a/plugins/ctf/common/metadata/ctf-meta-translate.c b/plugins/ctf/common/metadata/ctf-meta-translate.c index c11e698f..3603d177 100644 --- a/plugins/ctf/common/metadata/ctf-meta-translate.c +++ b/plugins/ctf/common/metadata/ctf-meta-translate.c @@ -516,7 +516,7 @@ struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class * if (sc->default_clock_class) { ret = bt_private_stream_class_set_default_clock_class(ir_sc, - bt_private_clock_class_borrow_clock_class(sc->default_clock_class)); + bt_private_clock_class_as_clock_class(sc->default_clock_class)); BT_ASSERT(ret == 0); } diff --git a/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c b/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c index da817a44..f2e48aae 100644 --- a/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c +++ b/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c @@ -49,10 +49,10 @@ int find_mapped_clock_class(struct ctf_field_class *fc, "clock class: expected-cc-name=\"%s\", " "other-cc-name=\"%s\"", bt_clock_class_get_name( - bt_private_clock_class_borrow_clock_class( + bt_private_clock_class_as_clock_class( *clock_class)), bt_clock_class_get_name( - bt_private_clock_class_borrow_clock_class( + bt_private_clock_class_as_clock_class( int_fc->mapped_clock_class))); ret = -1; goto end; diff --git a/plugins/ctf/common/metadata/ctf-meta.h b/plugins/ctf/common/metadata/ctf-meta.h index 5f4dce53..cb84d778 100644 --- a/plugins/ctf/common/metadata/ctf-meta.h +++ b/plugins/ctf/common/metadata/ctf-meta.h @@ -1560,7 +1560,7 @@ struct bt_private_clock_class *ctf_trace_class_borrow_clock_class_by_name( for (i = 0; i < tc->clock_classes->len; i++) { struct bt_private_clock_class *cc = tc->clock_classes->pdata[i]; const char *cc_name = bt_clock_class_get_name( - bt_private_clock_class_borrow_clock_class(cc)); + bt_private_clock_class_as_clock_class(cc)); BT_ASSERT(cc_name); if (strcmp(cc_name, name) == 0) { diff --git a/plugins/ctf/common/metadata/visitor-generate-ir.c b/plugins/ctf/common/metadata/visitor-generate-ir.c index dacef267..44c4e927 100644 --- a/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -4650,8 +4650,8 @@ void apply_clock_class_offset(struct ctx *ctx, } freq = bt_clock_class_get_frequency( - bt_private_clock_class_borrow_clock_class(clock)); - bt_clock_class_get_offset(bt_private_clock_class_borrow_clock_class(clock), + bt_private_clock_class_as_clock_class(clock)); + bt_clock_class_get_offset(bt_private_clock_class_as_clock_class(clock), &cur_offset_s, &cur_offset_cycles); /* Apply offsets */ @@ -4721,7 +4721,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) } clock_class_name = bt_clock_class_get_name( - bt_private_clock_class_borrow_clock_class(clock)); + bt_private_clock_class_as_clock_class(clock)); BT_ASSERT(clock_class_name); if (ctx->is_lttng && strcmp(clock_class_name, "monotonic") == 0) { /* @@ -4738,10 +4738,10 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) * frequency (move to the part in seconds). */ freq = bt_clock_class_get_frequency( - bt_private_clock_class_borrow_clock_class(clock)); + bt_private_clock_class_as_clock_class(clock)); calibrate_clock_class_offsets(&offset_seconds, &offset_cycles, freq); BT_ASSERT(offset_cycles < bt_clock_class_get_frequency( - bt_private_clock_class_borrow_clock_class(clock))); + bt_private_clock_class_as_clock_class(clock))); bt_private_clock_class_set_offset(clock, offset_seconds, offset_cycles); apply_clock_class_offset(ctx, clock); g_ptr_array_add(ctx->ctf_tc->clock_classes, bt_object_get_ref(clock)); diff --git a/plugins/ctf/common/notif-iter/notif-iter.c b/plugins/ctf/common/notif-iter/notif-iter.c index 259bb5cd..4ebff2ae 100644 --- a/plugins/ctf/common/notif-iter/notif-iter.c +++ b/plugins/ctf/common/notif-iter/notif-iter.c @@ -1694,12 +1694,12 @@ struct bt_private_field *borrow_next_field(struct bt_notif_iter *notit) BT_ASSERT(base_fc); switch (bt_field_class_get_type( - bt_private_field_class_borrow_field_class(base_fc))) { + bt_private_field_class_as_field_class(base_fc))) { case BT_FIELD_CLASS_TYPE_STRUCTURE: { BT_ASSERT(index < bt_field_class_structure_get_member_count( - bt_private_field_class_borrow_field_class( + bt_private_field_class_as_field_class( bt_private_field_borrow_class( base_field)))); next_field = @@ -1710,7 +1710,7 @@ struct bt_private_field *borrow_next_field(struct bt_notif_iter *notit) case BT_FIELD_CLASS_TYPE_STATIC_ARRAY: case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY: BT_ASSERT(index < bt_field_array_get_length( - bt_private_field_borrow_field(base_field))); + bt_private_field_as_field(base_field))); next_field = bt_private_field_array_borrow_element_field_by_index( base_field, index); break; @@ -1846,9 +1846,9 @@ update_def_clock: BT_ASSERT(field); BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc); BT_ASSERT(bt_field_get_class_type( - bt_private_field_borrow_field(field)) == + bt_private_field_as_field(field)) == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || - bt_field_get_class_type(bt_private_field_borrow_field(field)) == + bt_field_get_class_type(bt_private_field_as_field(field)) == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION); bt_private_field_unsigned_integer_set_value(field, value); stack_top(notit->stack)->index++; @@ -1891,7 +1891,7 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value, string_field = stack_top(notit->stack)->base; BT_ASSERT(bt_field_get_class_type( - bt_private_field_borrow_field(string_field)) == + bt_private_field_as_field(string_field)) == BT_FIELD_CLASS_TYPE_STRING); /* Append character */ @@ -1937,9 +1937,9 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value, BT_ASSERT(field); BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc); BT_ASSERT(bt_field_get_class_type( - bt_private_field_borrow_field(field)) == + bt_private_field_as_field(field)) == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || - bt_field_get_class_type(bt_private_field_borrow_field(field)) == + bt_field_get_class_type(bt_private_field_as_field(field)) == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION); bt_private_field_signed_integer_set_value(field, value); stack_top(notit->stack)->index++; @@ -1965,7 +1965,7 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value, BT_ASSERT(field); BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc); BT_ASSERT(bt_field_get_class_type( - bt_private_field_borrow_field(field)) == + bt_private_field_as_field(field)) == BT_FIELD_CLASS_TYPE_REAL); bt_private_field_real_set_value(field, value); stack_top(notit->stack)->index++; @@ -1990,7 +1990,7 @@ enum bt_bfcr_status bfcr_string_begin_cb( BT_ASSERT(field); BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc); BT_ASSERT(bt_field_get_class_type( - bt_private_field_borrow_field(field)) == + bt_private_field_as_field(field)) == BT_FIELD_CLASS_TYPE_STRING); ret = bt_private_field_string_clear(field); BT_ASSERT(ret == 0); @@ -2097,7 +2097,7 @@ enum bt_bfcr_status bfcr_compound_begin_cb( int ret; BT_ASSERT(bt_field_get_class_type( - bt_private_field_borrow_field(field)) == + bt_private_field_as_field(field)) == BT_FIELD_CLASS_TYPE_STRING); notit->done_filling_string = false; ret = bt_private_field_string_clear(field); @@ -2139,7 +2139,7 @@ enum bt_bfcr_status bfcr_compound_end_cb( if (array_fc->is_text) { BT_ASSERT(bt_field_get_class_type( - bt_private_field_borrow_field( + bt_private_field_as_field( stack_top(notit->stack)->base)) == BT_FIELD_CLASS_TYPE_STRING); bt_bfcr_set_unsigned_int_cb(notit->bfcr, @@ -2267,7 +2267,7 @@ void set_event_default_clock_value(struct bt_notif_iter *notit) struct bt_private_event *event = bt_private_notification_event_borrow_event( notit->event_notif); - struct bt_stream_class *sc = bt_private_stream_class_borrow_stream_class( + struct bt_stream_class *sc = bt_private_stream_class_as_stream_class( notit->meta.sc->ir_sc); BT_ASSERT(event); @@ -2345,7 +2345,7 @@ void notify_new_packet(struct bt_notif_iter *notit, } BT_ASSERT(notit->packet); - sc = bt_private_stream_class_borrow_stream_class(notit->meta.sc->ir_sc); + sc = bt_private_stream_class_as_stream_class(notit->meta.sc->ir_sc); BT_ASSERT(sc); if (bt_stream_class_packets_have_discarded_event_counter_snapshot(sc)) { diff --git a/plugins/ctf/fs-src/data-stream-file.c b/plugins/ctf/fs-src/data-stream-file.c index 2dcfc1d8..f700b02f 100644 --- a/plugins/ctf/fs-src/data-stream-file.c +++ b/plugins/ctf/fs-src/data-stream-file.c @@ -297,7 +297,7 @@ int convert_cycles_to_ns(struct bt_private_clock_class *clock_class, uint64_t cycles, int64_t *ns) { return bt_clock_class_cycles_to_ns_from_origin( - bt_private_clock_class_borrow_clock_class(clock_class), cycles, ns); + bt_private_clock_class_as_clock_class(clock_class), cycles, ns); } static diff --git a/plugins/ctf/fs-src/fs.c b/plugins/ctf/fs-src/fs.c index 85ec796f..082d8fa4 100644 --- a/plugins/ctf/fs-src/fs.c +++ b/plugins/ctf/fs-src/fs.c @@ -98,7 +98,7 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_next_one( BT_ASSERT(notif_iter_data->ds_file); status = ctf_fs_ds_file_next(notif_iter_data->ds_file, &priv_notif); - *notif = bt_private_notification_borrow_notification(priv_notif); + *notif = bt_private_notification_as_notification(priv_notif); if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK && bt_notification_get_type(*notif) == @@ -112,7 +112,7 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_next_one( BT_OBJECT_PUT_REF_AND_RESET(*notif); status = ctf_fs_ds_file_next(notif_iter_data->ds_file, &priv_notif); - *notif = bt_private_notification_borrow_notification(priv_notif); + *notif = bt_private_notification_as_notification(priv_notif); BT_ASSERT(status != BT_SELF_NOTIFICATION_ITERATOR_STATUS_END); goto end; } else { @@ -158,7 +158,7 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_next_one( } status = ctf_fs_ds_file_next(notif_iter_data->ds_file, &priv_notif); - *notif = bt_private_notification_borrow_notification(priv_notif); + *notif = bt_private_notification_as_notification(priv_notif); /* * If we get a notification, we expect to get a @@ -184,7 +184,7 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_next_one( BT_OBJECT_PUT_REF_AND_RESET(*notif); status = ctf_fs_ds_file_next(notif_iter_data->ds_file, &priv_notif); - *notif = bt_private_notification_borrow_notification(priv_notif); + *notif = bt_private_notification_as_notification(priv_notif); BT_ASSERT(status != BT_SELF_NOTIFICATION_ITERATOR_STATUS_END); } } @@ -249,7 +249,7 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_init( int iret; port_data = bt_self_component_port_get_data( - bt_self_component_port_output_borrow_self_component_port( + bt_self_component_port_output_as_self_component_port( self_port)); BT_ASSERT(port_data); notif_iter_data = g_new0(struct ctf_fs_notif_iter_data, 1); @@ -348,7 +348,7 @@ void ctf_fs_trace_destroy_notifier(void *data) void ctf_fs_finalize(struct bt_self_component_source *component) { ctf_fs_destroy(bt_self_component_get_data( - bt_self_component_source_borrow_self_component(component))); + bt_self_component_source_as_self_component(component))); } static @@ -657,7 +657,7 @@ int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, if (props.snapshots.beginning_clock != UINT64_C(-1)) { BT_ASSERT(sc->default_clock_class); ret = bt_clock_class_cycles_to_ns_from_origin( - bt_private_clock_class_borrow_clock_class( + bt_private_clock_class_as_clock_class( sc->default_clock_class), props.snapshots.beginning_clock, &begin_ns); if (ret) { @@ -1257,7 +1257,7 @@ struct ctf_fs_component *ctf_fs_create( } bt_self_component_set_data( - bt_self_component_source_borrow_self_component(self_comp), + bt_self_component_source_as_self_component(self_comp), ctf_fs); /* @@ -1311,7 +1311,7 @@ error: ctf_fs_destroy(ctf_fs); ctf_fs = NULL; bt_self_component_set_data( - bt_self_component_source_borrow_self_component(self_comp), + bt_self_component_source_as_self_component(self_comp), NULL); end: diff --git a/plugins/ctf/fs-src/query.c b/plugins/ctf/fs-src/query.c index ec8eccbe..026c9582 100644 --- a/plugins/ctf/fs-src/query.c +++ b/plugins/ctf/fs-src/query.c @@ -175,7 +175,7 @@ end: fclose(metadata_fp); } - *user_result = bt_private_value_borrow_value(result); + *user_result = bt_private_value_as_value(result); return status; } @@ -213,7 +213,7 @@ int add_range(struct bt_private_value *info, struct range *range, } status = bt_private_value_map_insert_entry(info, range_name, - bt_private_value_borrow_value(range_map)); + bt_private_value_as_value(range_map)); if (status != BT_VALUE_STATUS_OK) { ret = -1; goto end; @@ -326,14 +326,14 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group, } status = bt_private_value_map_insert_entry(group_info, "paths", - bt_private_value_borrow_value(file_paths)); + bt_private_value_as_value(file_paths)); if (status != BT_VALUE_STATUS_OK) { ret = -1; goto end; } ret = add_stream_ids(group_info, - bt_private_stream_borrow_stream(group->stream)); + bt_private_stream_as_stream(group->stream)); if (ret) { goto end; } @@ -428,7 +428,7 @@ int populate_trace_info(const char *trace_path, const char *trace_name, trace_intersection.set = true; status = bt_private_value_array_append_element( file_groups, - bt_private_value_borrow_value(group_info)); + bt_private_value_as_value(group_info)); bt_object_put_ref(group_info); if (status != BT_VALUE_STATUS_OK) { goto end; @@ -450,7 +450,7 @@ int populate_trace_info(const char *trace_path, const char *trace_name, } status = bt_private_value_map_insert_entry(trace_info, "streams", - bt_private_value_borrow_value(file_groups)); + bt_private_value_as_value(file_groups)); BT_OBJECT_PUT_REF_AND_RESET(file_groups); if (status != BT_VALUE_STATUS_OK) { ret = -1; @@ -538,7 +538,7 @@ enum bt_query_status trace_info_query( } status = bt_private_value_array_append_element(result, - bt_private_value_borrow_value(trace_info)); + bt_private_value_as_value(trace_info)); bt_object_put_ref(trace_info); if (status != BT_VALUE_STATUS_OK) { goto error; @@ -576,6 +576,6 @@ end: g_list_free(trace_names); } - *user_result = bt_private_value_borrow_value(result); + *user_result = bt_private_value_as_value(result); return status; } diff --git a/plugins/text/dmesg/dmesg.c b/plugins/text/dmesg/dmesg.c index c3fa1145..ef3d723e 100644 --- a/plugins/text/dmesg/dmesg.c +++ b/plugins/text/dmesg/dmesg.c @@ -163,7 +163,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) ret = bt_private_stream_class_set_default_clock_class( dmesg_comp->stream_class, - bt_private_clock_class_borrow_clock_class( + bt_private_clock_class_as_clock_class( dmesg_comp->clock_class)); if (ret) { BT_LOGE_STR("Cannot set stream class's default clock class."); @@ -399,14 +399,14 @@ enum bt_self_component_status dmesg_init( } bt_self_component_set_data( - bt_self_component_source_borrow_self_component(self_comp), + bt_self_component_source_as_self_component(self_comp), dmesg_comp); goto end; error: destroy_dmesg_component(dmesg_comp); bt_self_component_set_data( - bt_self_component_source_borrow_self_component(self_comp), + bt_self_component_source_as_self_component(self_comp), NULL); if (status >= 0) { @@ -421,7 +421,7 @@ BT_HIDDEN void dmesg_finalize(struct bt_self_component_source *self_comp) { destroy_dmesg_component(bt_self_component_get_data( - bt_self_component_source_borrow_self_component(self_comp))); + bt_self_component_source_as_self_component(self_comp))); } static @@ -639,7 +639,7 @@ enum bt_self_notification_iterator_status dmesg_notif_iter_init( } dmesg_comp = bt_self_component_get_data( - bt_self_component_source_borrow_self_component(self_comp)); + bt_self_component_source_as_self_component(self_comp)); BT_ASSERT(dmesg_comp); dmesg_notif_iter->dmesg_comp = dmesg_comp; dmesg_notif_iter->pc_notif_iter = self_notif_iter; @@ -819,7 +819,7 @@ enum bt_self_notification_iterator_status dmesg_notif_iter_next( status = dmesg_notif_iter_next_one(dmesg_notif_iter, &priv_notif); - notifs[i] = bt_private_notification_borrow_notification( + notifs[i] = bt_private_notification_as_notification( priv_notif); if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) { i++; diff --git a/plugins/text/pretty/pretty.c b/plugins/text/pretty/pretty.c index 30d7d54f..2b83b1de 100644 --- a/plugins/text/pretty/pretty.c +++ b/plugins/text/pretty/pretty.c @@ -118,7 +118,7 @@ void pretty_finalize(struct bt_self_component_sink *comp) { destroy_pretty_data( bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(comp))); + bt_self_component_sink_as_self_component(comp))); } static @@ -161,7 +161,7 @@ enum bt_self_component_status pretty_port_connected( struct pretty_component *pretty; pretty = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(comp)); + bt_self_component_sink_as_self_component(comp)); BT_ASSERT(pretty); BT_ASSERT(!pretty->iterator); pretty->iterator = bt_self_component_port_input_notification_iterator_create( @@ -181,7 +181,7 @@ enum bt_self_component_status pretty_consume( bt_notification_array notifs; struct bt_self_component_port_input_notification_iterator *it; struct pretty_component *pretty = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(comp)); + bt_self_component_sink_as_self_component(comp)); enum bt_notification_iterator_status it_ret; uint64_t count = 0; uint64_t i = 0; @@ -257,7 +257,7 @@ bt_bool check_param_exists(const char *key, struct bt_value *object, void *data) struct pretty_component *pretty = data; if (!bt_value_map_has_entry( - bt_private_value_borrow_value(pretty->plugin_opt_map), + bt_private_value_as_value(pretty->plugin_opt_map), key)) { fprintf(pretty->err, "[warning] Parameter \"%s\" unknown to \"text.pretty\" sink component\n", key); @@ -668,7 +668,7 @@ enum bt_self_component_status pretty_init( set_use_colors(pretty); bt_self_component_set_data( - bt_self_component_sink_borrow_self_component(comp), pretty); + bt_self_component_sink_as_self_component(comp), pretty); init_stream_packet_context_quarks(); end: diff --git a/plugins/utils/counter/counter.c b/plugins/utils/counter/counter.c index f9ce107f..7bf9b799 100644 --- a/plugins/utils/counter/counter.c +++ b/plugins/utils/counter/counter.c @@ -114,7 +114,7 @@ void counter_finalize(struct bt_self_component_sink *comp) BT_ASSERT(comp); counter = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(comp)); + bt_self_component_sink_as_self_component(comp)); BT_ASSERT(counter); try_print_last(counter); bt_object_put_ref(counter->notif_iter); @@ -163,7 +163,7 @@ enum bt_self_component_status counter_init( } bt_self_component_set_data( - bt_self_component_sink_borrow_self_component(component), + bt_self_component_sink_as_self_component(component), counter); goto end; @@ -185,7 +185,7 @@ enum bt_self_component_status counter_port_connected( struct bt_self_component_port_input_notification_iterator *iterator; counter = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(comp)); + bt_self_component_sink_as_self_component(comp)); BT_ASSERT(counter); iterator = bt_self_component_port_input_notification_iterator_create( self_port); @@ -211,7 +211,7 @@ enum bt_self_component_status counter_consume( bt_notification_array notifs; counter = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(comp)); + bt_self_component_sink_as_self_component(comp)); BT_ASSERT(counter); if (unlikely(!counter->notif_iter)) { diff --git a/plugins/utils/dummy/dummy.c b/plugins/utils/dummy/dummy.c index b3178416..ecb58f57 100644 --- a/plugins/utils/dummy/dummy.c +++ b/plugins/utils/dummy/dummy.c @@ -40,7 +40,7 @@ void dummy_finalize(struct bt_self_component_sink *comp) BT_ASSERT(comp); dummy = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(comp)); + bt_self_component_sink_as_self_component(comp)); BT_ASSERT(dummy); destroy_private_dummy_data(dummy); } @@ -65,7 +65,7 @@ enum bt_self_component_status dummy_init( } bt_self_component_set_data( - bt_self_component_sink_borrow_self_component(component), dummy); + bt_self_component_sink_as_self_component(component), dummy); goto end; error: @@ -86,7 +86,7 @@ enum bt_self_component_status dummy_port_connected( struct bt_self_component_port_input_notification_iterator *iterator; dummy = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(comp)); + bt_self_component_sink_as_self_component(comp)); BT_ASSERT(dummy); iterator = bt_self_component_port_input_notification_iterator_create( self_port); @@ -113,7 +113,7 @@ enum bt_self_component_status dummy_consume( uint64_t i; dummy = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component(component)); + bt_self_component_sink_as_self_component(component)); BT_ASSERT(dummy); if (unlikely(!dummy->notif_iter)) { diff --git a/plugins/utils/muxer/muxer.c b/plugins/utils/muxer/muxer.c index ac48ceae..8cd83299 100644 --- a/plugins/utils/muxer/muxer.c +++ b/plugins/utils/muxer/muxer.c @@ -174,7 +174,7 @@ enum bt_self_component_status ensure_available_input_port( struct bt_self_component_filter *self_comp) { struct muxer_comp *muxer_comp = bt_self_component_get_data( - bt_self_component_filter_borrow_self_component(self_comp)); + bt_self_component_filter_as_self_component(self_comp)); enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; GString *port_name = NULL; @@ -287,7 +287,7 @@ int configure_muxer_comp(struct muxer_comp *muxer_comp, struct bt_value *params) } ret = bt_value_map_extend(&real_params, - bt_private_value_borrow_value(default_params), params); + bt_private_value_as_value(default_params), params); if (ret) { BT_LOGE("Cannot extend default parameters map value: " "muxer-comp-addr=%p, def-params-addr=%p, " @@ -297,7 +297,7 @@ int configure_muxer_comp(struct muxer_comp *muxer_comp, struct bt_value *params) } assume_absolute_clock_classes = bt_value_map_borrow_entry_value( - bt_private_value_borrow_value(real_params), + bt_private_value_as_value(real_params), ASSUME_ABSOLUTE_CLOCK_CLASSES_PARAM_NAME); if (assume_absolute_clock_classes && !bt_value_is_bool(assume_absolute_clock_classes)) { @@ -358,7 +358,7 @@ enum bt_self_component_status muxer_init( muxer_comp->self_comp = self_comp; bt_self_component_set_data( - bt_self_component_filter_borrow_self_component(self_comp), + bt_self_component_filter_as_self_component(self_comp), muxer_comp); status = ensure_available_input_port(self_comp); if (status != BT_SELF_COMPONENT_STATUS_OK) { @@ -387,7 +387,7 @@ enum bt_self_component_status muxer_init( error: destroy_muxer_comp(muxer_comp); bt_self_component_set_data( - bt_self_component_filter_borrow_self_component(self_comp), + bt_self_component_filter_as_self_component(self_comp), NULL); if (status == BT_SELF_COMPONENT_STATUS_OK) { @@ -402,7 +402,7 @@ BT_HIDDEN void muxer_finalize(struct bt_self_component_filter *self_comp) { struct muxer_comp *muxer_comp = bt_self_component_get_data( - bt_self_component_filter_borrow_self_component(self_comp)); + bt_self_component_filter_as_self_component(self_comp)); BT_LOGD("Finalizing muxer component: comp-addr=%p", self_comp); @@ -414,8 +414,8 @@ struct bt_self_component_port_input_notification_iterator * create_notif_iter_on_input_port( struct bt_self_component_port_input *self_port, int *ret) { - struct bt_port *port = bt_self_component_port_borrow_port( - bt_self_component_port_input_borrow_self_component_port( + struct bt_port *port = bt_self_component_port_as_port( + bt_self_component_port_input_as_self_component_port( self_port)); struct bt_self_component_port_input_notification_iterator *notif_iter = NULL; @@ -542,8 +542,8 @@ int muxer_notif_iter_handle_newly_connected_ports( } self_port = node->data; - port = bt_self_component_port_borrow_port( - bt_self_component_port_input_borrow_self_component_port( + port = bt_self_component_port_as_port( + bt_self_component_port_input_as_self_component_port( (self_port))); BT_ASSERT(port); @@ -1174,7 +1174,7 @@ int muxer_notif_iter_init_newly_connected_ports(struct muxer_comp *muxer_comp, * handled by muxer_notif_iter_handle_newly_connected_ports(). */ count = bt_component_filter_get_input_port_count( - bt_self_component_filter_borrow_component_filter( + bt_self_component_filter_as_component_filter( muxer_comp->self_comp)); if (count < 0) { BT_LOGD("No input port to initialize for muxer component's notification iterator: " @@ -1190,8 +1190,8 @@ int muxer_notif_iter_init_newly_connected_ports(struct muxer_comp *muxer_comp, struct bt_port *port; BT_ASSERT(self_port); - port = bt_self_component_port_borrow_port( - bt_self_component_port_input_borrow_self_component_port( + port = bt_self_component_port_as_port( + bt_self_component_port_input_as_self_component_port( self_port)); BT_ASSERT(port); @@ -1238,7 +1238,7 @@ enum bt_self_notification_iterator_status muxer_notif_iter_init( int ret; muxer_comp = bt_self_component_get_data( - bt_self_component_filter_borrow_self_component(self_comp)); + bt_self_component_filter_as_self_component(self_comp)); BT_ASSERT(muxer_comp); BT_LOGD("Initializing muxer component's notification iterator: " "comp-addr=%p, muxer-comp-addr=%p, notif-iter-addr=%p", @@ -1389,12 +1389,12 @@ enum bt_self_component_status muxer_input_port_connected( struct bt_port_output *other_port) { enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; - struct bt_port *port = bt_self_component_port_borrow_port( - bt_self_component_port_input_borrow_self_component_port( + struct bt_port *port = bt_self_component_port_as_port( + bt_self_component_port_input_as_self_component_port( self_port)); struct muxer_comp *muxer_comp = bt_self_component_get_data( - bt_self_component_filter_borrow_self_component( + bt_self_component_filter_as_self_component( self_comp)); size_t i; int ret; @@ -1407,7 +1407,7 @@ enum bt_self_component_status muxer_input_port_connected( "other-port-addr=%p, other-port-name=\"%s\"", self_comp, muxer_comp, self_port, bt_port_get_name(port), other_port, - bt_port_get_name(bt_port_output_borrow_port(other_port))); + bt_port_get_name(bt_port_output_as_port(other_port))); for (i = 0; i < muxer_comp->muxer_notif_iters->len; i++) { struct muxer_notif_iter *muxer_notif_iter = @@ -1465,11 +1465,11 @@ void muxer_input_port_disconnected( { struct muxer_comp *muxer_comp = bt_self_component_get_data( - bt_self_component_filter_borrow_self_component( + bt_self_component_filter_as_self_component( self_component)); struct bt_port *port = - bt_self_component_port_borrow_port( - bt_self_component_port_input_borrow_self_component_port( + bt_self_component_port_as_port( + bt_self_component_port_input_as_self_component_port( self_port)); BT_ASSERT(port); diff --git a/tests/lib/test-plugin-plugins/sfs.c b/tests/lib/test-plugin-plugins/sfs.c index d58b8ea8..567a85f4 100644 --- a/tests/lib/test-plugin-plugins/sfs.c +++ b/tests/lib/test-plugin-plugins/sfs.c @@ -65,7 +65,7 @@ static enum bt_query_status flt_query_method( struct bt_value **result) { struct bt_private_value *res = bt_private_value_array_create(); - *result = bt_private_value_borrow_value(res); + *result = bt_private_value_as_value(res); int iret; BT_ASSERT(*result); diff --git a/tests/lib/test_bt_notification_iterator.c b/tests/lib/test_bt_notification_iterator.c index e90ad648..c0d25d0a 100644 --- a/tests/lib/test_bt_notification_iterator.c +++ b/tests/lib/test_bt_notification_iterator.c @@ -262,25 +262,25 @@ void init_static_data(void) BT_ASSERT(src_event_class); src_stream1 = bt_private_stream_create(src_stream_class); BT_ASSERT(src_stream1); - pub_src_stream1 = bt_private_stream_borrow_stream(src_stream1); + pub_src_stream1 = bt_private_stream_as_stream(src_stream1); src_stream2 = bt_private_stream_create(src_stream_class); BT_ASSERT(src_stream2); - pub_src_stream2 = bt_private_stream_borrow_stream(src_stream2); + pub_src_stream2 = bt_private_stream_as_stream(src_stream2); src_stream1_packet1 = bt_private_packet_create(src_stream1); BT_ASSERT(src_stream1_packet1); - pub_src_stream1_packet1 = bt_private_packet_borrow_packet( + pub_src_stream1_packet1 = bt_private_packet_as_packet( src_stream1_packet1); src_stream1_packet2 = bt_private_packet_create(src_stream1); BT_ASSERT(src_stream1_packet2); - pub_src_stream1_packet2 = bt_private_packet_borrow_packet( + pub_src_stream1_packet2 = bt_private_packet_as_packet( src_stream1_packet2); src_stream2_packet1 = bt_private_packet_create(src_stream2); BT_ASSERT(src_stream2_packet1); - pub_src_stream2_packet1 = bt_private_packet_borrow_packet( + pub_src_stream2_packet1 = bt_private_packet_as_packet( src_stream2_packet1); src_stream2_packet2 = bt_private_packet_create(src_stream2); BT_ASSERT(src_stream2_packet2); - pub_src_stream2_packet2 = bt_private_packet_borrow_packet( + pub_src_stream2_packet2 = bt_private_packet_as_packet( src_stream2_packet2); if (debug) { @@ -357,62 +357,62 @@ void src_iter_next_seq_one(struct bt_self_notification_iterator* notif_iter, switch (user_data->seq[user_data->at]) { case SEQ_STREAM1_BEGIN: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_stream_begin_create( notif_iter, src_stream1)); break; case SEQ_STREAM2_BEGIN: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_stream_begin_create( notif_iter, src_stream2)); break; case SEQ_STREAM1_END: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_stream_end_create( notif_iter, src_stream1)); break; case SEQ_STREAM2_END: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_stream_end_create( notif_iter, src_stream2)); break; case SEQ_STREAM1_PACKET1_BEGIN: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_packet_begin_create( notif_iter, src_stream1_packet1)); break; case SEQ_STREAM1_PACKET2_BEGIN: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_packet_begin_create( notif_iter, src_stream1_packet2)); break; case SEQ_STREAM2_PACKET1_BEGIN: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_packet_begin_create( notif_iter, src_stream2_packet1)); break; case SEQ_STREAM2_PACKET2_BEGIN: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_packet_begin_create( notif_iter, src_stream2_packet2)); break; case SEQ_STREAM1_PACKET1_END: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_packet_end_create( notif_iter, src_stream1_packet1)); break; case SEQ_STREAM1_PACKET2_END: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_packet_end_create( notif_iter, src_stream1_packet2)); break; case SEQ_STREAM2_PACKET1_END: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_packet_end_create( notif_iter, src_stream2_packet1)); break; case SEQ_STREAM2_PACKET2_END: - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_packet_end_create( notif_iter, src_stream2_packet2)); break; @@ -433,7 +433,7 @@ void src_iter_next_seq_one(struct bt_self_notification_iterator* notif_iter, } if (event_packet) { - *notif = bt_private_notification_borrow_notification( + *notif = bt_private_notification_as_notification( bt_private_notification_event_create( notif_iter, src_event_class, event_packet)); } @@ -612,7 +612,7 @@ enum bt_self_component_status sink_consume( enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK; struct sink_user_data *user_data = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component( + bt_self_component_sink_as_self_component( self_comp)); enum bt_notification_iterator_status it_ret; @@ -647,7 +647,7 @@ enum bt_self_component_status sink_port_connected( { struct sink_user_data *user_data = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component( + bt_self_component_sink_as_self_component( self_comp)); BT_ASSERT(user_data); @@ -667,7 +667,7 @@ enum bt_self_component_status sink_init( BT_ASSERT(user_data); bt_self_component_set_data( - bt_self_component_sink_borrow_self_component(self_comp), + bt_self_component_sink_as_self_component(self_comp), user_data); ret = bt_self_component_sink_add_input_port( self_comp, "in", NULL, NULL); @@ -680,7 +680,7 @@ void sink_finalize(struct bt_self_component_sink *self_comp) { struct sink_user_data *user_data = bt_self_component_get_data( - bt_self_component_sink_borrow_self_component( + bt_self_component_sink_as_self_component( self_comp)); if (user_data) { @@ -716,7 +716,7 @@ void create_source_sink(struct bt_private_graph *graph, src_comp_class, src_iter_finalize); BT_ASSERT(ret == 0); ret = bt_private_graph_add_source_component(graph, - bt_private_component_class_source_borrow_component_class_source( + bt_private_component_class_source_as_component_class_source( src_comp_class), "source", NULL, source); BT_ASSERT(ret == 0); bt_object_put_ref(src_comp_class); @@ -736,7 +736,7 @@ void create_source_sink(struct bt_private_graph *graph, sink_comp_class, sink_port_connected); BT_ASSERT(ret == 0); ret = bt_private_graph_add_sink_component(graph, - bt_private_component_class_sink_borrow_component_class_sink( + bt_private_component_class_sink_as_component_class_sink( sink_comp_class), "sink", NULL, sink); BT_ASSERT(ret == 0); diff --git a/tests/lib/test_bt_values.c b/tests/lib/test_bt_values.c index 796cb582..52a2f559 100644 --- a/tests/lib/test_bt_values.c +++ b/tests/lib/test_bt_values.c @@ -49,7 +49,7 @@ void test_bool(void) struct bt_value *obj; priv_obj = bt_private_value_bool_create(); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ok(obj && bt_value_is_bool(obj), "bt_private_value_bool_create() returns a boolean value object"); @@ -67,7 +67,7 @@ void test_bool(void) value = BT_FALSE; priv_obj = bt_private_value_bool_create_init(BT_TRUE); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ok(obj && bt_value_is_bool(obj), "bt_private_value_bool_create_init() returns a boolean value object"); value = bt_value_bool_get(obj); @@ -85,7 +85,7 @@ void test_integer(void) struct bt_value *obj; priv_obj = bt_private_value_integer_create(); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ok(obj && bt_value_is_integer(obj), "bt_private_value_integer_create() returns an integer value object"); @@ -101,7 +101,7 @@ void test_integer(void) pass("putting an existing integer value object does not cause a crash") priv_obj = bt_private_value_integer_create_init(321456987); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ok(obj && bt_value_is_integer(obj), "bt_private_value_integer_create_init() returns an integer value object"); value = bt_value_integer_get(obj); @@ -119,7 +119,7 @@ void test_real(void) struct bt_value *obj; priv_obj = bt_private_value_real_create(); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ok(obj && bt_value_is_real(obj), "bt_private_value_real_create() returns a real number value object"); @@ -136,7 +136,7 @@ void test_real(void) pass("putting an existing real number value object does not cause a crash") priv_obj = bt_private_value_real_create_init(33.1649758); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ok(obj && bt_value_is_real(obj), "bt_private_value_real_create_init() returns a real number value object"); value = bt_value_real_get(obj); @@ -154,7 +154,7 @@ void test_string(void) struct bt_value *obj; priv_obj = bt_private_value_string_create(); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ok(obj && bt_value_is_string(obj), "bt_private_value_string_create() returns a string value object"); @@ -171,7 +171,7 @@ void test_string(void) pass("putting an existing string value object does not cause a crash") priv_obj = bt_private_value_string_create_init("initial value"); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ok(obj && bt_value_is_string(obj), "bt_private_value_string_create_init() returns a string value object"); value = bt_value_string_get(obj); @@ -195,22 +195,22 @@ void test_array(void) struct bt_value *array_obj; priv_array_obj = bt_private_value_array_create(); - array_obj = bt_private_value_borrow_value(priv_array_obj); + array_obj = bt_private_value_as_value(priv_array_obj); ok(array_obj && bt_value_is_array(array_obj), "bt_private_value_array_create() returns an array value object"); ok(bt_value_array_is_empty(array_obj), "initial array value object size is 0"); priv_obj = bt_private_value_integer_create_init(345); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ret = bt_private_value_array_append_element(priv_array_obj, obj); BT_OBJECT_PUT_REF_AND_RESET(priv_obj); priv_obj = bt_private_value_real_create_init(-17.45); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ret |= bt_private_value_array_append_element(priv_array_obj, obj); BT_OBJECT_PUT_REF_AND_RESET(priv_obj); priv_obj = bt_private_value_bool_create_init(BT_TRUE); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ret |= bt_private_value_array_append_element(priv_array_obj, obj); BT_OBJECT_PUT_REF_AND_RESET(priv_obj); ret |= bt_private_value_array_append_element(priv_array_obj, @@ -242,7 +242,7 @@ void test_array(void) "bt_value_array_borrow_element_by_index() returns an value object with the appropriate type (null)"); priv_obj = bt_private_value_integer_create_init(1001); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); BT_ASSERT(obj); ok(!bt_private_value_array_set_element_by_index(priv_array_obj, 2, obj), "bt_value_array_set_element_by_index() succeeds"); @@ -503,22 +503,22 @@ void test_map(void) struct map_foreach_checklist checklist; priv_map_obj = bt_private_value_map_create(); - map_obj = bt_private_value_borrow_value(priv_map_obj); + map_obj = bt_private_value_as_value(priv_map_obj); ok(map_obj && bt_value_is_map(map_obj), "bt_private_value_map_create() returns a map value object"); ok(bt_value_map_get_size(map_obj) == 0, "initial map value object size is 0"); priv_obj = bt_private_value_integer_create_init(19457); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ret = bt_private_value_map_insert_entry(priv_map_obj, "int", obj); BT_OBJECT_PUT_REF_AND_RESET(priv_obj); priv_obj = bt_private_value_real_create_init(5.444); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ret |= bt_private_value_map_insert_entry(priv_map_obj, "real", obj); BT_OBJECT_PUT_REF_AND_RESET(priv_obj); priv_obj = bt_private_value_bool_create(); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ret |= bt_private_value_map_insert_entry(priv_map_obj, "bt_bool", obj); BT_OBJECT_PUT_REF_AND_RESET(priv_obj); ret |= bt_private_value_map_insert_entry(priv_map_obj, "null", @@ -528,7 +528,7 @@ void test_map(void) "inserting an element into a map value object increment its size"); priv_obj = bt_private_value_bool_create_init(BT_TRUE); - obj = bt_private_value_borrow_value(priv_obj); + obj = bt_private_value_as_value(priv_obj); ret = bt_private_value_map_insert_entry(priv_map_obj, "bt_bool", obj); BT_OBJECT_PUT_REF_AND_RESET(priv_obj); ok(!ret, "bt_private_value_map_insert_entry() accepts an existing key"); @@ -652,13 +652,13 @@ void test_compare_bool(void) BT_ASSERT(bool1 && bool2 && bool3); ok(!bt_value_compare(bt_value_null, - bt_private_value_borrow_value(bool1)), + bt_private_value_as_value(bool1)), "cannot compare null value object and bt_bool value object"); - ok(!bt_value_compare(bt_private_value_borrow_value(bool1), - bt_private_value_borrow_value(bool2)), + ok(!bt_value_compare(bt_private_value_as_value(bool1), + bt_private_value_as_value(bool2)), "boolean value objects are not equivalent (BT_FALSE and BT_TRUE)"); - ok(bt_value_compare(bt_private_value_borrow_value(bool1), - bt_private_value_borrow_value(bool3)), + ok(bt_value_compare(bt_private_value_as_value(bool1), + bt_private_value_as_value(bool3)), "boolean value objects are equivalent (BT_FALSE and BT_FALSE)"); BT_OBJECT_PUT_REF_AND_RESET(bool1); @@ -678,13 +678,13 @@ void test_compare_integer(void) BT_ASSERT(int1 && int2 && int3); ok(!bt_value_compare(bt_value_null, - bt_private_value_borrow_value(int1)), + bt_private_value_as_value(int1)), "cannot compare null value object and integer value object"); - ok(!bt_value_compare(bt_private_value_borrow_value(int1), - bt_private_value_borrow_value(int2)), + ok(!bt_value_compare(bt_private_value_as_value(int1), + bt_private_value_as_value(int2)), "integer value objects are not equivalent (10 and -23)"); - ok(bt_value_compare(bt_private_value_borrow_value(int1), - bt_private_value_borrow_value(int3)), + ok(bt_value_compare(bt_private_value_as_value(int1), + bt_private_value_as_value(int3)), "integer value objects are equivalent (10 and 10)"); BT_OBJECT_PUT_REF_AND_RESET(int1); @@ -705,13 +705,13 @@ void test_compare_real(void) BT_ASSERT(real1 && real2 && real3); ok(!bt_value_compare(bt_value_null, - bt_private_value_borrow_value(real1)), + bt_private_value_as_value(real1)), "cannot compare null value object and real number value object"); - ok(!bt_value_compare(bt_private_value_borrow_value(real1), - bt_private_value_borrow_value(real2)), + ok(!bt_value_compare(bt_private_value_as_value(real1), + bt_private_value_as_value(real2)), "real number value objects are not equivalent (17.38 and -14.23)"); - ok(bt_value_compare(bt_private_value_borrow_value(real1), - bt_private_value_borrow_value(real3)), + ok(bt_value_compare(bt_private_value_as_value(real1), + bt_private_value_as_value(real3)), "real number value objects are equivalent (17.38 and 17.38)"); BT_OBJECT_PUT_REF_AND_RESET(real1); @@ -732,13 +732,13 @@ void test_compare_string(void) BT_ASSERT(string1 && string2 && string3); ok(!bt_value_compare(bt_value_null, - bt_private_value_borrow_value(string1)), + bt_private_value_as_value(string1)), "cannot compare null value object and string value object"); - ok(!bt_value_compare(bt_private_value_borrow_value(string1), - bt_private_value_borrow_value(string2)), + ok(!bt_value_compare(bt_private_value_as_value(string1), + bt_private_value_as_value(string2)), "string value objects are not equivalent (\"hello\" and \"bt_value\")"); - ok(bt_value_compare(bt_private_value_borrow_value(string1), - bt_private_value_borrow_value(string3)), + ok(bt_value_compare(bt_private_value_as_value(string1), + bt_private_value_as_value(string3)), "string value objects are equivalent (\"hello\" and \"hello\")"); BT_OBJECT_PUT_REF_AND_RESET(string1); @@ -756,8 +756,8 @@ void test_compare_array(void) BT_ASSERT(array1 && array2 && array3); - ok(bt_value_compare(bt_private_value_borrow_value(array1), - bt_private_value_borrow_value(array2)), + ok(bt_value_compare(bt_private_value_as_value(array1), + bt_private_value_as_value(array2)), "empty array value objects are equivalent"); status = bt_private_value_array_append_integer_element(array1, 23); @@ -779,20 +779,20 @@ void test_compare_array(void) status = bt_private_value_array_append_bool_element(array3, BT_FALSE); BT_ASSERT(status == BT_VALUE_STATUS_OK); BT_ASSERT(bt_value_array_get_size( - bt_private_value_borrow_value(array1)) == 3); + bt_private_value_as_value(array1)) == 3); BT_ASSERT(bt_value_array_get_size( - bt_private_value_borrow_value(array2)) == 3); + bt_private_value_as_value(array2)) == 3); BT_ASSERT(bt_value_array_get_size( - bt_private_value_borrow_value(array3)) == 3); + bt_private_value_as_value(array3)) == 3); ok(!bt_value_compare(bt_value_null, - bt_private_value_borrow_value(array1)), + bt_private_value_as_value(array1)), "cannot compare null value object and array value object"); - ok(!bt_value_compare(bt_private_value_borrow_value(array1), - bt_private_value_borrow_value(array2)), + ok(!bt_value_compare(bt_private_value_as_value(array1), + bt_private_value_as_value(array2)), "array value objects are not equivalent ([23, 14.2, BT_FALSE] and [14.2, 23, BT_FALSE])"); - ok(bt_value_compare(bt_private_value_borrow_value(array1), - bt_private_value_borrow_value(array3)), + ok(bt_value_compare(bt_private_value_as_value(array1), + bt_private_value_as_value(array3)), "array value objects are equivalent ([23, 14.2, BT_FALSE] and [23, 14.2, BT_FALSE])"); BT_OBJECT_PUT_REF_AND_RESET(array1); @@ -810,8 +810,8 @@ void test_compare_map(void) BT_ASSERT(map1 && map2 && map3); - ok(bt_value_compare(bt_private_value_borrow_value(map1), - bt_private_value_borrow_value(map2)), + ok(bt_value_compare(bt_private_value_as_value(map1), + bt_private_value_as_value(map2)), "empty map value objects are equivalent"); @@ -837,20 +837,20 @@ void test_compare_map(void) status = bt_private_value_map_insert_real_entry(map3, "two", 14.2); BT_ASSERT(status == BT_VALUE_STATUS_OK); BT_ASSERT(bt_value_map_get_size( - bt_private_value_borrow_value(map1)) == 3); + bt_private_value_as_value(map1)) == 3); BT_ASSERT(bt_value_map_get_size( - bt_private_value_borrow_value(map2)) == 3); + bt_private_value_as_value(map2)) == 3); BT_ASSERT(bt_value_map_get_size( - bt_private_value_borrow_value(map3)) == 3); + bt_private_value_as_value(map3)) == 3); ok(!bt_value_compare(bt_value_null, - bt_private_value_borrow_value(map1)), + bt_private_value_as_value(map1)), "cannot compare null value object and map value object"); - ok(!bt_value_compare(bt_private_value_borrow_value(map1), - bt_private_value_borrow_value(map2)), + ok(!bt_value_compare(bt_private_value_as_value(map1), + bt_private_value_as_value(map2)), "map value objects are not equivalent"); - ok(bt_value_compare(bt_private_value_borrow_value(map1), - bt_private_value_borrow_value(map3)), + ok(bt_value_compare(bt_private_value_as_value(map1), + bt_private_value_as_value(map3)), "map value objects are equivalent"); BT_OBJECT_PUT_REF_AND_RESET(map1); @@ -901,26 +901,26 @@ void test_copy(void) array_obj && map_obj); status = bt_private_value_array_append_element(array_obj, - bt_private_value_borrow_value(bool_obj)); + bt_private_value_as_value(bool_obj)); BT_ASSERT(status == BT_VALUE_STATUS_OK); status = bt_private_value_array_append_element(array_obj, - bt_private_value_borrow_value(integer_obj)); + bt_private_value_as_value(integer_obj)); BT_ASSERT(status == BT_VALUE_STATUS_OK); status = bt_private_value_array_append_element(array_obj, - bt_private_value_borrow_value(real_obj)); + bt_private_value_as_value(real_obj)); BT_ASSERT(status == BT_VALUE_STATUS_OK); status = bt_private_value_array_append_element(array_obj, bt_value_null); BT_ASSERT(status == BT_VALUE_STATUS_OK); status = bt_private_value_map_insert_entry(map_obj, "array", - bt_private_value_borrow_value(array_obj)); + bt_private_value_as_value(array_obj)); BT_ASSERT(status == BT_VALUE_STATUS_OK); status = bt_private_value_map_insert_entry(map_obj, "string", - bt_private_value_borrow_value(string_obj)); + bt_private_value_as_value(string_obj)); BT_ASSERT(status == BT_VALUE_STATUS_OK); status = bt_value_copy(&map_copy_obj, - bt_private_value_borrow_value(map_obj)); + bt_private_value_as_value(map_obj)); ok(status == BT_VALUE_STATUS_OK && map_copy_obj, "bt_value_copy() succeeds"); @@ -948,11 +948,11 @@ void test_copy(void) "bt_value_copy() returns a different pointer (real)"); null_copy_obj = bt_private_value_array_borrow_element_by_index( array_copy_obj, 3); - ok(bt_private_value_borrow_value(null_copy_obj) == bt_value_null, + ok(bt_private_value_as_value(null_copy_obj) == bt_value_null, "bt_value_copy() returns the same pointer (null)"); - ok(bt_value_compare(bt_private_value_borrow_value(map_obj), - bt_private_value_borrow_value(map_copy_obj)), + ok(bt_value_compare(bt_private_value_as_value(map_obj), + bt_private_value_as_value(map_copy_obj)), "source and destination value objects have the same content"); BT_OBJECT_PUT_REF_AND_RESET(map_copy_obj); @@ -1013,27 +1013,27 @@ void test_extend(void) BT_ASSERT(status == BT_VALUE_STATUS_OK); status = bt_value_map_extend( &extended_map, - bt_private_value_borrow_value(base_map), - bt_private_value_borrow_value(extension_map)); + bt_private_value_as_value(base_map), + bt_private_value_as_value(extension_map)); ok(status == BT_VALUE_STATUS_OK && extended_map, "bt_value_map_extend() succeeds"); ok(bt_value_map_get_size( - bt_private_value_borrow_value(extended_map)) == 5, + bt_private_value_as_value(extended_map)) == 5, "bt_value_map_extend() returns a map object with the correct size"); - ok(compare_map_elements(bt_private_value_borrow_value(base_map), - bt_private_value_borrow_value(extended_map), "file"), + ok(compare_map_elements(bt_private_value_as_value(base_map), + bt_private_value_as_value(extended_map), "file"), "bt_value_map_extend() picks the appropriate element (file)"); - ok(compare_map_elements(bt_private_value_borrow_value(extension_map), - bt_private_value_borrow_value(extended_map), "edit"), + ok(compare_map_elements(bt_private_value_as_value(extension_map), + bt_private_value_as_value(extended_map), "edit"), "bt_value_map_extend() picks the appropriate element (edit)"); - ok(compare_map_elements(bt_private_value_borrow_value(base_map), - bt_private_value_borrow_value(extended_map), "selection"), + ok(compare_map_elements(bt_private_value_as_value(base_map), + bt_private_value_as_value(extended_map), "selection"), "bt_value_map_extend() picks the appropriate element (selection)"); - ok(compare_map_elements(bt_private_value_borrow_value(extension_map), - bt_private_value_borrow_value(extended_map), "find"), + ok(compare_map_elements(bt_private_value_as_value(extension_map), + bt_private_value_as_value(extended_map), "find"), "bt_value_map_extend() picks the appropriate element (find)"); - ok(compare_map_elements(bt_private_value_borrow_value(extension_map), - bt_private_value_borrow_value(extended_map), "project"), + ok(compare_map_elements(bt_private_value_as_value(extension_map), + bt_private_value_as_value(extended_map), "project"), "bt_value_map_extend() picks the appropriate element (project)"); BT_OBJECT_PUT_REF_AND_RESET(array); diff --git a/tests/lib/test_graph_topo.c b/tests/lib/test_graph_topo.c index 25845292..f1eb2344 100644 --- a/tests/lib/test_graph_topo.c +++ b/tests/lib/test_graph_topo.c @@ -381,13 +381,13 @@ enum bt_self_component_status src_accept_output_port_connection( struct event event = { .type = SRC_COMP_ACCEPT_OUTPUT_PORT_CONNECTION, .data.src_comp_accept_output_port_connection = { - .comp = bt_self_component_borrow_component( - bt_self_component_source_borrow_self_component( + .comp = bt_self_component_as_component( + bt_self_component_source_as_self_component( self_comp)), - .self_port = bt_self_component_port_borrow_port( - bt_self_component_port_output_borrow_self_component_port( + .self_port = bt_self_component_port_as_port( + bt_self_component_port_output_as_self_component_port( self_comp_port)), - .other_port = bt_port_input_borrow_port(other_port), + .other_port = bt_port_input_as_port(other_port), }, }; @@ -404,13 +404,13 @@ enum bt_self_component_status sink_accept_input_port_connection( struct event event = { .type = SINK_COMP_ACCEPT_INPUT_PORT_CONNECTION, .data.sink_comp_accept_input_port_connection = { - .comp = bt_self_component_borrow_component( - bt_self_component_sink_borrow_self_component( + .comp = bt_self_component_as_component( + bt_self_component_sink_as_self_component( self_comp)), - .self_port = bt_self_component_port_borrow_port( - bt_self_component_port_input_borrow_self_component_port( + .self_port = bt_self_component_port_as_port( + bt_self_component_port_input_as_self_component_port( self_comp_port)), - .other_port = bt_port_output_borrow_port(other_port), + .other_port = bt_port_output_as_port(other_port), }, }; @@ -428,13 +428,13 @@ enum bt_self_component_status src_output_port_connected( struct event event = { .type = SRC_COMP_OUTPUT_PORT_CONNECTED, .data.src_comp_output_port_connected = { - .comp = bt_self_component_borrow_component( - bt_self_component_source_borrow_self_component( + .comp = bt_self_component_as_component( + bt_self_component_source_as_self_component( self_comp)), - .self_port = bt_self_component_port_borrow_port( - bt_self_component_port_output_borrow_self_component_port( + .self_port = bt_self_component_port_as_port( + bt_self_component_port_output_as_self_component_port( self_comp_port)), - .other_port = bt_port_input_borrow_port(other_port), + .other_port = bt_port_input_as_port(other_port), }, }; @@ -464,13 +464,13 @@ enum bt_self_component_status sink_input_port_connected( struct event event = { .type = SINK_COMP_INPUT_PORT_CONNECTED, .data.sink_comp_input_port_connected = { - .comp = bt_self_component_borrow_component( - bt_self_component_sink_borrow_self_component( + .comp = bt_self_component_as_component( + bt_self_component_sink_as_self_component( self_comp)), - .self_port = bt_self_component_port_borrow_port( - bt_self_component_port_input_borrow_self_component_port( + .self_port = bt_self_component_port_as_port( + bt_self_component_port_input_as_self_component_port( self_comp_port)), - .other_port = bt_port_output_borrow_port(other_port), + .other_port = bt_port_output_as_port(other_port), }, }; @@ -491,11 +491,11 @@ void src_output_port_disconnected(struct bt_self_component_source *self_comp, struct event event = { .type = SRC_COMP_OUTPUT_PORT_DISCONNECTED, .data.src_comp_output_port_disconnected = { - .comp = bt_self_component_borrow_component( - bt_self_component_source_borrow_self_component( + .comp = bt_self_component_as_component( + bt_self_component_source_as_self_component( self_comp)), - .self_port = bt_self_component_port_borrow_port( - bt_self_component_port_output_borrow_self_component_port( + .self_port = bt_self_component_port_as_port( + bt_self_component_port_output_as_self_component_port( self_comp_port)), }, }; @@ -505,7 +505,7 @@ void src_output_port_disconnected(struct bt_self_component_source *self_comp, switch (current_test) { case TEST_SINK_REMOVES_PORT_IN_CONSUME_THEN_SRC_REMOVES_DISCONNECTED_PORT: ret = bt_self_component_port_remove_from_component( - bt_self_component_port_output_borrow_self_component_port( + bt_self_component_port_output_as_self_component_port( self_comp_port)); BT_ASSERT(ret == 0); default: @@ -520,11 +520,11 @@ void sink_input_port_disconnected(struct bt_self_component_sink *self_comp, struct event event = { .type = SINK_COMP_INPUT_PORT_DISCONNECTED, .data.sink_comp_input_port_disconnected = { - .comp = bt_self_component_borrow_component( - bt_self_component_sink_borrow_self_component( + .comp = bt_self_component_as_component( + bt_self_component_sink_as_self_component( self_comp)), - .self_port = bt_self_component_port_borrow_port( - bt_self_component_port_input_borrow_self_component_port( + .self_port = bt_self_component_port_as_port( + bt_self_component_port_input_as_self_component_port( self_comp_port)), }, }; @@ -572,7 +572,7 @@ enum bt_self_component_status sink_consume( self_comp, "in"); BT_ASSERT(def_port); ret = bt_self_component_port_remove_from_component( - bt_self_component_port_input_borrow_self_component_port( + bt_self_component_port_input_as_self_component_port( def_port)); BT_ASSERT(ret == 0); break; @@ -590,8 +590,8 @@ void graph_src_output_port_added(struct bt_component_source *comp, struct event event = { .type = GRAPH_SRC_OUTPUT_PORT_ADDED, .data.graph_src_output_port_added = { - .comp = bt_component_source_borrow_component(comp), - .port = bt_port_output_borrow_port(port), + .comp = bt_component_source_as_component(comp), + .port = bt_port_output_as_port(port), }, }; @@ -605,8 +605,8 @@ void graph_sink_input_port_added(struct bt_component_sink *comp, struct event event = { .type = GRAPH_SINK_INPUT_PORT_ADDED, .data.graph_sink_input_port_added = { - .comp = bt_component_sink_borrow_component(comp), - .port = bt_port_input_borrow_port(port), + .comp = bt_component_sink_as_component(comp), + .port = bt_port_input_as_port(port), }, }; @@ -620,8 +620,8 @@ void graph_src_output_port_removed(struct bt_component_source *comp, struct event event = { .type = GRAPH_SRC_OUTPUT_PORT_REMOVED, .data.graph_src_output_port_removed = { - .comp = bt_component_source_borrow_component(comp), - .port = bt_port_output_borrow_port(port), + .comp = bt_component_source_as_component(comp), + .port = bt_port_output_as_port(port), }, }; @@ -635,8 +635,8 @@ void graph_sink_input_port_removed(struct bt_component_sink *comp, struct event event = { .type = GRAPH_SINK_INPUT_PORT_REMOVED, .data.graph_sink_input_port_removed = { - .comp = bt_component_sink_borrow_component(comp), - .port = bt_port_input_borrow_port(port), + .comp = bt_component_sink_as_component(comp), + .port = bt_port_input_as_port(port), }, }; @@ -653,13 +653,13 @@ void graph_src_sink_ports_connected(struct bt_component_source *upstream_comp, .type = GRAPH_SRC_SINK_PORTS_CONNECTED, .data.graph_src_sink_ports_connected = { .upstream_comp = - bt_component_source_borrow_component(upstream_comp), + bt_component_source_as_component(upstream_comp), .downstream_comp = - bt_component_sink_borrow_component(downstream_comp), + bt_component_sink_as_component(downstream_comp), .upstream_port = - bt_port_output_borrow_port(upstream_port), + bt_port_output_as_port(upstream_port), .downstream_port = - bt_port_input_borrow_port(downstream_port), + bt_port_input_as_port(downstream_port), }, }; @@ -676,13 +676,13 @@ void graph_src_sink_ports_disconnected(struct bt_component_source *upstream_comp .type = GRAPH_SRC_SINK_PORTS_DISCONNECTED, .data.graph_src_sink_ports_disconnected = { .upstream_comp = - bt_component_source_borrow_component(upstream_comp), + bt_component_source_as_component(upstream_comp), .downstream_comp = - bt_component_sink_borrow_component(downstream_comp), + bt_component_sink_as_component(downstream_comp), .upstream_port = - bt_port_output_borrow_port(upstream_port), + bt_port_output_as_port(upstream_port), .downstream_port = - bt_port_input_borrow_port(downstream_port), + bt_port_input_as_port(downstream_port), }, }; @@ -743,7 +743,7 @@ struct bt_component_source *create_src(struct bt_private_graph *graph) int ret; ret = bt_private_graph_add_source_component(graph, - bt_private_component_class_source_borrow_component_class_source( + bt_private_component_class_source_as_component_class_source( src_comp_class), "src-comp", NULL, &comp); BT_ASSERT(ret == 0); @@ -757,7 +757,7 @@ struct bt_component_sink *create_sink(struct bt_private_graph *graph) int ret; ret = bt_private_graph_add_sink_component(graph, - bt_private_component_class_sink_borrow_component_class_sink( + bt_private_component_class_sink_as_component_class_sink( sink_comp_class), "sink-comp", NULL, &comp); BT_ASSERT(ret == 0); @@ -839,10 +839,10 @@ void test_sink_removes_port_in_consume_then_src_removes_disconnected_port(void) status = bt_private_graph_connect_ports(graph, src_def_port, sink_def_port, NULL); BT_ASSERT(status == 0); - gsrc = bt_component_source_borrow_component(src); - gsink = bt_component_sink_borrow_component(sink); - gsrc_def_port = bt_port_output_borrow_port(src_def_port); - gsink_def_port = bt_port_input_borrow_port(sink_def_port); + gsrc = bt_component_source_as_component(src); + gsink = bt_component_sink_as_component(sink); + gsrc_def_port = bt_port_output_as_port(src_def_port); + gsink_def_port = bt_port_input_as_port(sink_def_port); /* We're supposed to have 7 events so far */ ok(events->len == 7, "we have the expected number of events (before consume)"); @@ -1018,10 +1018,10 @@ void test_sink_removes_port_in_consume(void) status = bt_private_graph_connect_ports(graph, src_def_port, sink_def_port, NULL); BT_ASSERT(status == 0); - gsrc = bt_component_source_borrow_component(src); - gsink = bt_component_sink_borrow_component(sink); - gsrc_def_port = bt_port_output_borrow_port(src_def_port); - gsink_def_port = bt_port_input_borrow_port(sink_def_port); + gsrc = bt_component_source_as_component(src); + gsink = bt_component_sink_as_component(sink); + gsrc_def_port = bt_port_output_as_port(src_def_port); + gsink_def_port = bt_port_input_as_port(sink_def_port); /* We're supposed to have 7 events so far */ ok(events->len == 7, "we have the expected number of events (before consume)"); @@ -1183,11 +1183,11 @@ void test_src_adds_port_in_port_connected(void) src_hello_port = bt_component_source_borrow_output_port_by_name(src, "hello"); BT_ASSERT(src_hello_port); - gsrc = bt_component_source_borrow_component(src); - gsink = bt_component_sink_borrow_component(sink); - gsrc_def_port = bt_port_output_borrow_port(src_def_port); - gsrc_hello_port = bt_port_output_borrow_port(src_hello_port); - gsink_def_port = bt_port_input_borrow_port(sink_def_port); + gsrc = bt_component_source_as_component(src); + gsink = bt_component_sink_as_component(sink); + gsrc_def_port = bt_port_output_as_port(src_def_port); + gsrc_hello_port = bt_port_output_as_port(src_hello_port); + gsink_def_port = bt_port_input_as_port(sink_def_port); /* We're supposed to have 8 events */ ok(events->len == 8, "we have the expected number of events"); @@ -1303,10 +1303,10 @@ void test_simple(void) status = bt_private_graph_connect_ports(graph, src_def_port, sink_def_port, NULL); BT_ASSERT(status == 0); - gsrc = bt_component_source_borrow_component(src); - gsink = bt_component_sink_borrow_component(sink); - gsrc_def_port = bt_port_output_borrow_port(src_def_port); - gsink_def_port = bt_port_input_borrow_port(sink_def_port); + gsrc = bt_component_source_as_component(src); + gsink = bt_component_sink_as_component(sink); + gsrc_def_port = bt_port_output_as_port(src_def_port); + gsink_def_port = bt_port_input_as_port(sink_def_port); /* We're supposed to have 7 events */ ok(events->len == 7, "we have the expected number of events"); @@ -1411,10 +1411,10 @@ void test_src_port_connected_error(void) ok(status != BT_GRAPH_STATUS_OK, "bt_private_graph_connect_ports() returns an error"); ok(!conn, "returned connection is still NULL"); - gsrc = bt_component_source_borrow_component(src); - gsink = bt_component_sink_borrow_component(sink); - gsrc_def_port = bt_port_output_borrow_port(src_def_port); - gsink_def_port = bt_port_input_borrow_port(sink_def_port); + gsrc = bt_component_source_as_component(src); + gsink = bt_component_sink_as_component(sink); + gsrc_def_port = bt_port_output_as_port(src_def_port); + gsink_def_port = bt_port_input_as_port(sink_def_port); /* We're supposed to have 5 events */ ok(events->len == 5, "we have the expected number of events"); @@ -1499,10 +1499,10 @@ void test_sink_port_connected_error(void) ok(status != BT_GRAPH_STATUS_OK, "bt_private_graph_connect_ports() returns an error"); ok(!conn, "returned connection is still NULL"); - gsrc = bt_component_source_borrow_component(src); - gsink = bt_component_sink_borrow_component(sink); - gsrc_def_port = bt_port_output_borrow_port(src_def_port); - gsink_def_port = bt_port_input_borrow_port(sink_def_port); + gsrc = bt_component_source_as_component(src); + gsink = bt_component_sink_as_component(sink); + gsrc_def_port = bt_port_output_as_port(src_def_port); + gsink_def_port = bt_port_input_as_port(sink_def_port); /* We're supposed to have 5 events */ ok(events->len == 7, "we have the expected number of events"); diff --git a/tests/lib/test_plugin.c b/tests/lib/test_plugin.c index bd59512b..eae1ab51 100644 --- a/tests/lib/test_plugin.c +++ b/tests/lib/test_plugin.c @@ -164,7 +164,7 @@ static void test_sfs(const char *plugin_dir) ok(sink_comp_class, "bt_plugin_borrow_sink_component_class_by_name() finds a sink component class"); ok(strcmp(bt_component_class_get_help( - bt_component_class_sink_borrow_component_class(sink_comp_class)), + bt_component_class_sink_as_component_class(sink_comp_class)), "Bacon ipsum dolor amet strip steak cupim pastrami venison shoulder.\n" "Prosciutto beef ribs flank meatloaf pancetta brisket kielbasa drumstick\n" "venison tenderloin cow tail. Beef short loin shoulder meatball, sirloin\n" @@ -178,8 +178,8 @@ static void test_sfs(const char *plugin_dir) params = bt_private_value_integer_create_init(23); BT_ASSERT(params); ret = bt_private_query_executor_query(query_exec, - bt_component_class_filter_borrow_component_class(filter_comp_class), - "get-something", bt_private_value_borrow_value(params), + bt_component_class_filter_as_component_class(filter_comp_class), + "get-something", bt_private_value_as_value(params), &results); ok(ret == 0 && results, "bt_private_query_executor_query() succeeds"); BT_ASSERT(bt_value_is_array(results) && bt_value_array_get_size(results) == 2); @@ -189,7 +189,7 @@ static void test_sfs(const char *plugin_dir) ok(strcmp(object_str, "get-something") == 0, "bt_component_class_query() receives the expected object name"); res_params = bt_value_array_borrow_element_by_index(results, 1); - ok(res_params == bt_private_value_borrow_value(params), + ok(res_params == bt_private_value_as_value(params), "bt_component_class_query() receives the expected parameters"); bt_object_get_ref(sink_comp_class); -- 2.34.1