}
if (bt_value_map_has_entry(
- bt_value_borrow_from_private(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",
goto error;
}
- value = bt_value_borrow_from_private(
+ 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_value_borrow_from_private(
+ 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_value_borrow_from_private(
+ value = bt_private_value_as_value(
bt_private_value_string_create_init(
state->scanner->value.v_string));
break;
} else if (!strcmp(id, "true") || !strcmp(id, "TRUE") ||
!strcmp(id, "yes") ||
!strcmp(id, "YES")) {
- value = bt_value_borrow_from_private(
+ 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_value_borrow_from_private(
+ value = bt_private_value_as_value(
bt_private_value_bool_create_init(false));
} else {
- value = bt_value_borrow_from_private(
+ value = bt_private_value_as_value(
bt_private_value_string_create_init(id));
}
break;
goto error;
}
- value = bt_value_borrow_from_private(
+ 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_value_borrow_from_private(
+ value = bt_private_value_as_value(
bt_private_value_real_create_init(
-state->scanner->value.v_float));
break;
goto end;
}
- ret = bt_value_string_get(str_obj, &suffix);
- if (ret) {
- printf_err("Unexpected error\n");
- goto end;
- }
+ suffix = bt_value_string_get(str_obj);
g_string_assign(tmpstr, prefix);
g_string_append(tmpstr, "-");
goto end;
}
- if (bt_value_map_has_entry(bt_value_borrow_from_private(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);
}
cfg->cmd_data.help.cfg_component =
- bt_config_component_create(BT_COMPONENT_CLASS_TYPE_UNKNOWN,
- NULL, NULL);
+ bt_config_component_create(-1, NULL, NULL);
if (!cfg->cmd_data.help.cfg_component) {
goto error;
}
comp_cls_name);
} else {
/* Fall back to plugin help */
- cfg->cmd_data.help.cfg_component->type =
- BT_COMPONENT_CLASS_TYPE_UNKNOWN;
g_string_assign(
cfg->cmd_data.help.cfg_component->plugin_name,
leftover);
GString *cur_param_key = NULL;
char error_buf[256] = { 0 };
long retry_duration = -1;
+ enum bt_value_status status;
struct poptOption run_long_options[] = {
{ "base-params", 'b', POPT_ARG_STRING, NULL, OPT_BASE_PARAMS, NULL, NULL },
{ "component", 'c', POPT_ARG_STRING, NULL, OPT_COMPONENT, NULL, NULL },
BT_ASSERT(cur_base_params);
bt_object_put_ref(cur_cfg_comp->params);
- cur_cfg_comp->params = bt_value_copy(
- bt_value_borrow_from_private(cur_base_params));
- if (!cur_cfg_comp->params) {
+ status = bt_value_copy(
+ &cur_cfg_comp->params,
+ bt_private_value_as_value(cur_base_params));
+ if (status != BT_VALUE_STATUS_OK) {
print_err_oom();
goto error;
}
goto error;
}
- params_to_set = bt_value_map_extend(
- bt_value_borrow_from_private(cur_cfg_comp->params),
- bt_value_borrow_from_private(params));
+ status = bt_value_map_extend(¶ms_to_set,
+ bt_private_value_as_value(cur_cfg_comp->params),
+ bt_private_value_as_value(params));
BT_OBJECT_PUT_REF_AND_RESET(params);
- if (!params_to_set) {
+ if (status != BT_VALUE_STATUS_OK) {
printf_err("Cannot extend current component parameters with --params option's argument:\n %s\n",
arg);
goto error;
}
ret = bt_config_cli_args_create_connections(cfg,
- bt_value_borrow_from_private(connection_args),
+ bt_private_value_as_value(connection_args),
error_buf, 256);
if (ret) {
printf_err("Cannot creation connections:\n%s", error_buf);
goto end;
}
for (i = 0; i < len; i++) {
- int ret;
struct bt_value *arg_value =
bt_value_array_borrow_element_by_index(run_args, i);
const char *arg;
BT_ASSERT(arg_value);
- ret = bt_value_string_get(arg_value, &arg);
- BT_ASSERT(ret == 0);
+ arg = bt_value_string_get(arg_value);
BT_ASSERT(arg);
argv[i + 1] = arg;
}
}
name = get_component_auto_name(prefix,
- bt_value_borrow_from_private(existing_names));
+ bt_private_value_as_value(existing_names));
if (!name) {
ret = -1;
}
for (i = 0; i < bt_value_array_get_size(
- bt_value_borrow_from_private(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_value_borrow_from_private(impl_args->extra_params),
+ bt_private_value_as_value(impl_args->extra_params),
i);
if (!elem) {
goto error;
}
BT_ASSERT(bt_value_is_string(elem));
- if (bt_value_string_get(elem, &arg)) {
- goto error;
- }
-
+ arg = bt_value_string_get(elem);
ret = bt_private_value_array_append_string_element(run_args, arg);
if (ret) {
print_err_oom();
* component.
*/
name = get_component_auto_name(cur_name_prefix->str,
- bt_value_borrow_from_private(all_names));
+ bt_private_value_as_value(all_names));
append_name_opt = true;
} else {
/*
* component.
*/
if (bt_value_map_has_entry(
- bt_value_borrow_from_private(all_names),
+ bt_private_value_as_value(all_names),
cur_name->str)) {
printf_err("Duplicate component instance name:\n %s\n",
cur_name->str);
{
int ret = 0;
GList *leftover;
+ enum bt_value_status status;
for (leftover = leftovers; leftover != NULL;
leftover = g_list_next(leftover)) {
* this is where the unique path goes.
*/
BT_OBJECT_PUT_REF_AND_RESET(impl_args->extra_params);
- impl_args->extra_params =
- bt_value_copy(bt_value_borrow_from_private(
+ status = bt_value_copy(&impl_args->extra_params,
+ bt_private_value_as_value(
base_implicit_ctf_input_args->extra_params));
- if (!impl_args->extra_params) {
+ if (status != BT_VALUE_STATUS_OK) {
print_err_oom();
destroy_implicit_component_args(impl_args);
goto error;
implicit_text_args.exists = true;
ret = insert_flat_params_from_array(
implicit_text_args.params_arg,
- bt_value_borrow_from_private(fields), "field");
+ bt_private_value_as_value(fields), "field");
bt_object_put_ref(fields);
if (ret) {
goto error;
implicit_text_args.exists = true;
ret = insert_flat_params_from_array(
implicit_text_args.params_arg,
- bt_value_borrow_from_private(names), "name");
+ bt_private_value_as_value(names), "name");
bt_object_put_ref(names);
if (ret) {
goto error;
}
for (i = 0; i < bt_value_array_get_size(
- bt_value_borrow_from_private(run_args)); i++) {
+ bt_private_value_as_value(run_args)); i++) {
struct bt_value *arg_value =
bt_value_array_borrow_element_by_index(
- bt_value_borrow_from_private(run_args),
+ bt_private_value_as_value(run_args),
i);
const char *arg;
GString *quoted = NULL;
const char *arg_to_print;
BT_ASSERT(arg_value);
- ret = bt_value_string_get(arg_value, &arg);
- BT_ASSERT(ret == 0);
+ arg = bt_value_string_get(arg_value);
if (print_run_args) {
quoted = bt_common_shell_quote(arg, true);
}
if (i < bt_value_array_get_size(
- bt_value_borrow_from_private(run_args)) - 1) {
+ bt_private_value_as_value(run_args)) - 1) {
if (print_run_args) {
putchar(' ');
} else {
}
cfg = bt_config_run_from_args_array(
- bt_value_borrow_from_private(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) {