lib: rename transforming bt_X_borrow_Y() -> bt_X_as_Y()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 30 Nov 2018 21:42:13 +0000 (16:42 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
We're not borrowing anything, we're just converting the type.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
65 files changed:
cli/babeltrace-cfg-cli-args-connect.c
cli/babeltrace-cfg-cli-args.c
cli/babeltrace.c
include/babeltrace/graph/component-class-filter.h
include/babeltrace/graph/component-class-sink.h
include/babeltrace/graph/component-class-source.h
include/babeltrace/graph/component-filter.h
include/babeltrace/graph/component-sink.h
include/babeltrace/graph/component-source.h
include/babeltrace/graph/port-input.h
include/babeltrace/graph/port-output-notification-iterator.h
include/babeltrace/graph/port-output.h
include/babeltrace/graph/private-component-class-filter.h
include/babeltrace/graph/private-component-class-sink.h
include/babeltrace/graph/private-component-class-source.h
include/babeltrace/graph/private-component-class.h
include/babeltrace/graph/private-graph.h
include/babeltrace/graph/private-notification.h
include/babeltrace/graph/private-query-executor.h
include/babeltrace/graph/self-component-class-filter.h
include/babeltrace/graph/self-component-class-sink.h
include/babeltrace/graph/self-component-class-source.h
include/babeltrace/graph/self-component-filter.h
include/babeltrace/graph/self-component-port-input-notification-iterator.h
include/babeltrace/graph/self-component-port-input.h
include/babeltrace/graph/self-component-port-output.h
include/babeltrace/graph/self-component-port.h
include/babeltrace/graph/self-component-sink.h
include/babeltrace/graph/self-component-source.h
include/babeltrace/graph/self-component.h
include/babeltrace/private-values.h
include/babeltrace/trace-ir/private-clock-class.h
include/babeltrace/trace-ir/private-event-class.h
include/babeltrace/trace-ir/private-event.h
include/babeltrace/trace-ir/private-field-classes.h
include/babeltrace/trace-ir/private-fields.h
include/babeltrace/trace-ir/private-packet.h
include/babeltrace/trace-ir/private-stream-class.h
include/babeltrace/trace-ir/private-stream.h
include/babeltrace/trace-ir/private-trace.h
lib/ctf-writer/attributes.c
lib/ctf-writer/trace.c
lib/graph/component-class-sink-colander.c
lib/graph/graph.c
lib/plugin/plugin-so.c
lib/trace-ir/attributes.c
lib/trace-ir/trace.c
plugins/ctf/common/metadata/ctf-meta-translate.c
plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c
plugins/ctf/common/metadata/ctf-meta.h
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/ctf/common/notif-iter/notif-iter.c
plugins/ctf/fs-src/data-stream-file.c
plugins/ctf/fs-src/fs.c
plugins/ctf/fs-src/query.c
plugins/text/dmesg/dmesg.c
plugins/text/pretty/pretty.c
plugins/utils/counter/counter.c
plugins/utils/dummy/dummy.c
plugins/utils/muxer/muxer.c
tests/lib/test-plugin-plugins/sfs.c
tests/lib/test_bt_notification_iterator.c
tests/lib/test_bt_values.c
tests/lib/test_graph_topo.c
tests/lib/test_plugin.c

index 8e941e21d85aeb272cdcb2afd11ee63f68d386c6..c22fe6ad2e8bf1f75c5a0ccebe4178dff25870fe 100644 (file)
@@ -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,
index 76eb9c00b228c237bc5a284a31d4e620350eb98a..80802fbedf022b6a04d009e2bae2048ec965fa92 100644 (file)
@@ -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(&params_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) {
index c6daa07ade2b0dbee4df2818e7a6e36879e98b8b..29a54a5846e4c9155b4571cbbae8c48b5769b68d 100644 (file)
@@ -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;
index beddfa10bf8aad1703994e1471b77652fc8175c5..83365be3705cffb162fb5e62fb88d2174ac1aae7 100644 (file)
@@ -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;
index 45e701399e29f0d6d2c06302e4ac7c268e739a72..db28fe839ddafa3d9911d2848e80ea3c881cac6b 100644 (file)
@@ -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;
index 5bf1f178d331f5685a458d0bde5090e22bd8b509..8e24e9c0648dae8645123b8d861b3fcb844c0f0d 100644 (file)
@@ -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;
index ebc5538739b15c9401f3bcbc66f006e00bd41214..89238f2817bbfc34c68ef3641eb691f157b2d0a1 100644 (file)
@@ -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;
index 6c33eb757963a55ea2fe0406a26ef249536bee46..12fe73d4f4584a8f587c154ae851b3fd10e41283 100644 (file)
@@ -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;
index 91af914b95335a4a13cd728509e4d9cc43b8704f..cfdd41feb5c31ee994bb82b7e0a51d3ca39ba4bc 100644 (file)
@@ -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;
index b57e15dfd2d0873243536c643e4768afeb049142..9e55f828adf8f4fcc031aff8ebb0459ed65bb939 100644 (file)
@@ -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;
 }
index 2dd0bf22bd90be1ec46eaf4c6ed8ec5bd2ffd82c..a271a2125f76532cd8b2b7e9ba0b486d080e4a0a 100644 (file)
@@ -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;
index f27310d9ebde7e26b59bae8b3576823e6eacb537..986abb9464cc8ba2673ebadb29e02507f7e1b416 100644 (file)
@@ -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;
 }
index 663fad64ec74f1499d2bb155b24d0200487f8461..3830a50c28c4fc15c272395e3d8c8f49fe915ce6 100644 (file)
@@ -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;
index f29701e58b7818ea53be0629148ff21fc93d5960..9a1b7151b388d3a5cce896cd9b02d7e7b21fdf68 100644 (file)
@@ -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;
index 9c89c9b172eae5c747b62495633f947a3a969152..3238a62390d2ffa6c422f09f522a170deb8760df 100644 (file)
@@ -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;
index a39a6b1f010871a3959e30c5311921b9e1e18cfe..c8a7630501da83272c7fc8b89099cb078178a679 100644 (file)
@@ -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;
index 08c31c552f19d90068dce184e77a8701cd1dcc4c..542304c1871324252219ec14e54443c08ef7613d 100644 (file)
@@ -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;
 }
index 72b3840bdd06ac0fb636ee29a003367223aa52af..3833d632db0354cfcc27d8329bddfe126ac59b0c 100644 (file)
@@ -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;
index e2cbceb31f4f96957147c42f283bd17ada53c74c..2eeb48a3f88f62027f1e18f954ec371c998f5525 100644 (file)
@@ -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;
index d1a447cddddab86b8622e69b8e1cc05a9dd9baef..8a029a8df00e9669801c32eed3ae8e4d45633e98 100644 (file)
@@ -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;
index d3ab837792b8115bfd8931edecfda64bb01e1f98..01dacaa3bc58cf6c09bb9e9b4ca9387291d5a726 100644 (file)
@@ -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;
index 6cb41949dc62cebf924b5786a686530be7a72175..0cdbc8668724e8cd0851242ccd832aa612a46df0 100644 (file)
@@ -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;
index ad23cdeeb43bf741db46142aec893e17dc56cc55..4aef3cccf683b0064dca54e3671f1364dd682435 100644 (file)
@@ -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;
index 5bfb71049f911fb60ec12886e2da11da4f865d93..fd7e02fcab44fa779da1e0f39ba7e0c016a384c2 100644 (file)
@@ -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;
index a133059f04457097cf359a79389b8d3dca4a6638..d25e114479890fd8077e9a04ec12c40b60a2c486 100644 (file)
@@ -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;
index eaf5d9125c28602738a1405c9306284bd02e1e95..6857f3e84604a3245484688a6415c47866ca6bfe 100644 (file)
@@ -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;
index f8866b1b177ea6f3da3422a564ee5e187e55bf87..9eaacf1e29ddeb2cd3e59f7c8db5f75ffbb73951 100644 (file)
@@ -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;
index b98e764b71535deaa14d93e1b805ff5c8bdf75cb..bdb76c8a44556ad92a27720fa1dd87c6f84f730f 100644 (file)
@@ -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;
index 61bacd194595bfff735d0848df437f00ff8f5214..95ccdb7a9ad45c787cdfaf7c015ffd7a238a2bc6 100644 (file)
@@ -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;
index db2a8a8d84879049c387677e2c6e13283bf923d6..b5d8f551d5e4d5af7c10b11f810706dc8b14f02b 100644 (file)
@@ -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;
index b747b3d769455a9c12376c5c1d501c0c50d4d8e2..a6ebc68d16a3cbca2c189c62a128582a0bec29a3 100644 (file)
@@ -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;
index 39a2b485b3531015c66e5018b0aab796e1763ad6..20f54c42c341edd3b872c3e4d895e6f31131287c 100644 (file)
@@ -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;
index 16262456e99b7ae71acd16839ed2f7fbd3c3d22b..5965137cf8ecff486ec7ea79c70617af0b947639 100644 (file)
@@ -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;
index 1bb86491bb1501c1807d5696aed3704f77825eb6..dfa29c105efa244824d82ee0446e5b1cbd852a0d 100644 (file)
@@ -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;
index 6c6c56a22b69addb8e7e2d0e2c96ffbce9ba8c3d..017091ac2e6c5983265e2f3fa5bf7cb8726ace14 100644 (file)
@@ -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;
index 6199df0197a35f44efe266383107deba3a587f87..1d98f7acac62e6a83849cc3ee041637add0c4e87 100644 (file)
@@ -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;
index fa1c103de105b4410316dde195ecc5429c5ca660..febea34b0d568a8820a43fc1e72c21178eb6bac7 100644 (file)
@@ -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;
index 1f34a7e61eea63f90406edbd954fa6e82a674e1b..78113db07ed6f16d752c3fcfbb5f57bb56e7f2f6 100644 (file)
@@ -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;
index 973e39081bf72fc16a2941a300989d952dcd7ae4..a4e402e56e490ec75c8632db9c5c926b3b0f28e0 100644 (file)
@@ -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;
index a121a3e9214e51974b4342ad551164b276775061..8dfba8e86145b37711b4eceb6ebfeebdbfa3fe8c 100644 (file)
@@ -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;
index 5b4529f0809e3e3870981d8812e2f85bc14936de..cbaf29fbf7cfe7ceaeb15fd59c45e065161c2f52 100644 (file)
@@ -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:
index fd04695c1c4ad4f6840f0bfef8acefaba5759280..b21ec0f0abc0dc307255d25461cb5ae92cef412b 100644 (file)
@@ -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) {
index a40f8ea09e813122840db65c8e094aef3fa72bf5..712c473177c632cbe944315ab8a046f92e0c9fae 100644 (file)
@@ -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));
 }
 
index 1b4653de735b60c0f9f5e6625261c6214f59ad33..cc27a6998e48ef3e911050b4b92e1c6e9068875a 100644 (file)
@@ -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.");
index 357a4ccd6feffa911007366fb7755fcecd148e7b..9208dc535bb967b60661c000d868e2b5648f6799 100644 (file)
@@ -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:
index 44068de24c0e6387d457820447215e111d14c731..b38677394f340ec11a1dfbca71b5a6b716860296 100644 (file)
@@ -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:
index f5c66cb8332d22087d6ac4f1a0e5ccbd77542bde..be791f36fe2142b4a65a561662f41abc2cfc0bfa 100644 (file)
@@ -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));
 }
index c11e698fedbb1ebbf889b33b0db829a035881aa5..3603d177d4ab8b677ce9953946fef2f07769e82d 100644 (file)
@@ -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);
        }
 
index da817a447798d6875546761e9f5c895846a6bbc7..f2e48aae8fa081e2c072e02206638324f3380314 100644 (file)
@@ -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;
index 5f4dce53587a91c6e7263ab5d5035d576f80272e..cb84d77866031777a4dda929b5643058ac4ad26a 100644 (file)
@@ -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) {
index dacef267a8371dee8fc6284c2abeb04a4deda475..44c4e92782ca698b254971668df7c5a94e994b33 100644 (file)
@@ -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));
index 259bb5cdc5f4d6b11c85403edaa04cff865390c1..4ebff2ae0e6fa3462d49647ff297f67b59e64085 100644 (file)
@@ -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)) {
index 2dcfc1d8b5d914d7e63369e0b33556bbcad7ee0f..f700b02ffffec2a96f85584ddcb42cd328c68bc8 100644 (file)
@@ -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
index 85ec796f554b8bc1c004e00767644bf2b78ad4af..082d8fa48c978647a50a7da06a1f196a06847fea 100644 (file)
@@ -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:
index ec8eccbe44a674a421ded50ebc476c0b81364892..026c95829e4189df04c5ee0f71e1968a69c29ed8 100644 (file)
@@ -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;
 }
index c3fa11452764ad98b8454e426fa07be4ef90f41e..ef3d723ee9dda364e0ee551dea7e65fd0dcaaf68 100644 (file)
@@ -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++;
index 30d7d54f2da65fe2054697ecb1b71ef3a69e2b87..2b83b1def33d8b890249014805902385e6531e06 100644 (file)
@@ -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:
index f9ce107fba52b935e55cf19dc9e39df87cf01657..7bf9b799dd27f9a646fa9734fefa1be1b4e54db7 100644 (file)
@@ -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)) {
index b3178416bfd8f692edd125bbe2419b53240c38b3..ecb58f570d0024ce15a236856668e65cb3559982 100644 (file)
@@ -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)) {
index ac48ceaefe5a392a4afebfe7429dd2d87aa0565b..8cd83299436b9e2c1a92632c012bea943def0283 100644 (file)
@@ -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);
index d58b8ea8919ead2e76dbb01dd70385a338b559b3..567a85f4d396398f2a3e0e6f92b9063b48ec3fef 100644 (file)
@@ -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);
index e90ad648198685189b2b2b0b41c023d9d1096736..c0d25d0a213fc06ff94a3ad74dd60b2d9cb285d5 100644 (file)
@@ -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);
index 796cb582f2a49420cf01e3628d3307d065d8344c..52a2f559a3a8d8437c92d883b0b5a5a3fa2f35e6 100644 (file)
@@ -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);
index 25845292902ba7ac7ce6ad6e66d8f102c77ff481..f1eb23441a8eb2c1ec0e6b25679853bd8dcc170b 100644 (file)
@@ -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");
index bd59512b9707d06b7e86aa47ef6d1bb048d5e475..eae1ab51374164804357660a824a9b2338e5ae98 100644 (file)
@@ -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);
This page took 0.128641 seconds and 4 git commands to generate.