projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Values API: standardize function names
[babeltrace.git]
/
cli
/
babeltrace-cfg-cli-args.c
diff --git
a/cli/babeltrace-cfg-cli-args.c
b/cli/babeltrace-cfg-cli-args.c
index f15455c758c11b911656c0204b44a4b2769d1d01..145333a632fb28fb2cba2c286d8a45d73b6bd656 100644
(file)
--- a/
cli/babeltrace-cfg-cli-args.c
+++ b/
cli/babeltrace-cfg-cli-args.c
@@
-241,7
+241,7
@@
int ini_handle_state(struct ini_parsing_state *state)
goto error;
}
goto error;
}
- if (bt_value_map_has_
ke
y(state->params, state->last_map_key)) {
+ if (bt_value_map_has_
entr
y(state->params, state->last_map_key)) {
g_string_append_printf(state->ini_error,
"Duplicate parameter key: `%s`\n",
state->last_map_key);
g_string_append_printf(state->ini_error,
"Duplicate parameter key: `%s`\n",
state->last_map_key);
@@
-414,7
+414,7
@@
error:
success:
if (value) {
success:
if (value) {
- if (bt_value_map_insert(state->params,
+ if (bt_value_map_insert
_entry
(state->params,
state->last_map_key, value)) {
/* Only override return value on error */
ret = -1;
state->last_map_key, value)) {
/* Only override return value on error */
ret = -1;
@@
-1041,33
+1041,33
@@
struct bt_value *names_from_arg(const char *arg)
!strcmp(identifier, "args") ||
!strcmp(identifier, "arg")) {
found_item = true;
!strcmp(identifier, "args") ||
!strcmp(identifier, "arg")) {
found_item = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string
_element
(names,
"payload")) {
goto error;
}
} else if (!strcmp(identifier, "context") ||
!strcmp(identifier, "ctx")) {
found_item = true;
"payload")) {
goto error;
}
} else if (!strcmp(identifier, "context") ||
!strcmp(identifier, "ctx")) {
found_item = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string
_element
(names,
"context")) {
goto error;
}
} else if (!strcmp(identifier, "scope") ||
!strcmp(identifier, "header")) {
found_item = true;
"context")) {
goto error;
}
} else if (!strcmp(identifier, "scope") ||
!strcmp(identifier, "header")) {
found_item = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string
_element
(names,
identifier)) {
goto error;
}
} else if (!strcmp(identifier, "all")) {
found_all = true;
identifier)) {
goto error;
}
} else if (!strcmp(identifier, "all")) {
found_all = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string
_element
(names,
identifier)) {
goto error;
}
} else if (!strcmp(identifier, "none")) {
found_none = true;
identifier)) {
goto error;
}
} else if (!strcmp(identifier, "none")) {
found_none = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string
_element
(names,
identifier)) {
goto error;
}
identifier)) {
goto error;
}
@@
-1097,7
+1097,7
@@
end:
* least one item is specified.
*/
if (found_item && !found_none && !found_all) {
* least one item is specified.
*/
if (found_item && !found_none && !found_all) {
- if (bt_value_array_append_string(names, "none")) {
+ if (bt_value_array_append_string
_element
(names, "none")) {
goto error;
}
}
goto error;
}
}
@@
-1157,7
+1157,7
@@
struct bt_value *fields_from_arg(const char *arg)
!strcmp(identifier, "emf") ||
!strcmp(identifier, "callsite") ||
!strcmp(identifier, "all")) {
!strcmp(identifier, "emf") ||
!strcmp(identifier, "callsite") ||
!strcmp(identifier, "all")) {
- if (bt_value_array_append_string(fields,
+ if (bt_value_array_append_string
_element
(fields,
identifier)) {
goto error;
}
identifier)) {
goto error;
}
@@
-1240,8
+1240,9
@@
int insert_flat_params_from_array(GString *params_arg,
goto end;
}
goto end;
}
- for (i = 0; i < bt_value_array_size(names_array); i++) {
- struct bt_value *str_obj = bt_value_array_get(names_array, i);
+ for (i = 0; i < bt_value_array_get_size(names_array); i++) {
+ struct bt_value *str_obj =
+ bt_value_array_borrow_element_by_index(names_array, i);
const char *suffix;
bool is_default = false;
const char *suffix;
bool is_default = false;
@@
-1252,7
+1253,6
@@
int insert_flat_params_from_array(GString *params_arg,
}
ret = bt_value_string_get(str_obj, &suffix);
}
ret = bt_value_string_get(str_obj, &suffix);
- BT_PUT(str_obj);
if (ret) {
printf_err("Unexpected error\n");
goto end;
if (ret) {
printf_err("Unexpected error\n");
goto end;
@@
-1395,14
+1395,14
@@
int add_run_cfg_comp_check_name(struct bt_config *cfg,
goto end;
}
goto end;
}
- if (bt_value_map_has_
ke
y(instance_names, cfg_comp->instance_name->str)) {
+ if (bt_value_map_has_
entr
y(instance_names, cfg_comp->instance_name->str)) {
printf_err("Duplicate component instance name:\n %s\n",
cfg_comp->instance_name->str);
ret = -1;
goto end;
}
printf_err("Duplicate component instance name:\n %s\n",
cfg_comp->instance_name->str);
ret = -1;
goto end;
}
- if (bt_value_map_insert(instance_names,
+ if (bt_value_map_insert
_entry
(instance_names,
cfg_comp->instance_name->str, bt_value_null)) {
print_err_oom();
ret = -1;
cfg_comp->instance_name->str, bt_value_null)) {
print_err_oom();
ret = -1;
@@
-2565,7
+2565,7
@@
struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
goto error;
}
goto error;
}
- if (bt_value_map_insert_string(cur_cfg_comp->params,
+ if (bt_value_map_insert_string
_entry
(cur_cfg_comp->params,
cur_param_key->str, arg)) {
print_err_oom();
goto error;
cur_param_key->str, arg)) {
print_err_oom();
goto error;
@@
-2602,8
+2602,8
@@
struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
}
break;
case OPT_CONNECT:
}
break;
case OPT_CONNECT:
- if (bt_value_array_append_string
(connection_args,
- arg)) {
+ if (bt_value_array_append_string
_element(
+
connection_args,
arg)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-2709,7
+2709,7
@@
struct bt_config *bt_config_run_from_args_array(struct bt_value *run_args,
struct bt_config *cfg = NULL;
const char **argv;
int64_t i, len;
struct bt_config *cfg = NULL;
const char **argv;
int64_t i, len;
- const size_t argc = bt_value_array_size(run_args) + 1;
+ const size_t argc = bt_value_array_
get_
size(run_args) + 1;
argv = calloc(argc, sizeof(*argv));
if (!argv) {
argv = calloc(argc, sizeof(*argv));
if (!argv) {
@@
-2719,14
+2719,15
@@
struct bt_config *bt_config_run_from_args_array(struct bt_value *run_args,
argv[0] = "run";
argv[0] = "run";
- len = bt_value_array_size(run_args);
+ len = bt_value_array_
get_
size(run_args);
if (len < 0) {
printf_err("Invalid executable arguments\n");
goto end;
}
for (i = 0; i < len; i++) {
int ret;
if (len < 0) {
printf_err("Invalid executable arguments\n");
goto end;
}
for (i = 0; i < len; i++) {
int ret;
- struct bt_value *arg_value = bt_value_array_get(run_args, i);
+ struct bt_value *arg_value =
+ bt_value_array_borrow_element_by_index(run_args, i);
const char *arg;
BT_ASSERT(arg_value);
const char *arg;
BT_ASSERT(arg_value);
@@
-2734,7
+2735,6
@@
struct bt_config *bt_config_run_from_args_array(struct bt_value *run_args,
BT_ASSERT(ret == 0);
BT_ASSERT(arg);
argv[i + 1] = arg;
BT_ASSERT(ret == 0);
BT_ASSERT(arg);
argv[i + 1] = arg;
- bt_put(arg_value);
}
cfg = bt_config_run_from_args(argc, argv, retcode,
}
cfg = bt_config_run_from_args(argc, argv, retcode,
@@
-2936,7
+2936,7
@@
GString *get_component_auto_name(const char *prefix,
goto end;
}
goto end;
}
- if (!bt_value_map_has_
ke
y(existing_names, prefix)) {
+ if (!bt_value_map_has_
entr
y(existing_names, prefix)) {
g_string_assign(auto_name, prefix);
goto end;
}
g_string_assign(auto_name, prefix);
goto end;
}
@@
-2944,7
+2944,7
@@
GString *get_component_auto_name(const char *prefix,
do {
g_string_printf(auto_name, "%s-%d", prefix, i);
i++;
do {
g_string_printf(auto_name, "%s-%d", prefix, i);
i++;
- } while (bt_value_map_has_
ke
y(existing_names, auto_name->str));
+ } while (bt_value_map_has_
entr
y(existing_names, auto_name->str));
end:
return auto_name;
end:
return auto_name;
@@
-2979,7
+2979,7
@@
int assign_name_to_implicit_component(struct implicit_component_args *args,
g_string_assign(args->name_arg, name->str);
g_string_assign(args->name_arg, name->str);
- if (bt_value_map_insert(existing_names, name->str,
+ if (bt_value_map_insert
_entry
(existing_names, name->str,
bt_value_null)) {
print_err_oom();
ret = -1;
bt_value_null)) {
print_err_oom();
ret = -1;
@@
-3011,44
+3011,45
@@
int append_run_args_for_implicit_component(
goto end;
}
goto end;
}
- if (bt_value_array_append_string(run_args, "--component")) {
+ if (bt_value_array_append_string
_element
(run_args, "--component")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, impl_args->comp_arg->str)) {
+ if (bt_value_array_append_string
_element
(run_args, impl_args->comp_arg->str)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "--name")) {
+ if (bt_value_array_append_string
_element
(run_args, "--name")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, impl_args->name_arg->str)) {
+ if (bt_value_array_append_string
_element
(run_args, impl_args->name_arg->str)) {
print_err_oom();
goto error;
}
if (impl_args->params_arg->len > 0) {
print_err_oom();
goto error;
}
if (impl_args->params_arg->len > 0) {
- if (bt_value_array_append_string(run_args, "--params")) {
+ if (bt_value_array_append_string
_element
(run_args, "--params")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string
_element
(run_args,
impl_args->params_arg->str)) {
print_err_oom();
goto error;
}
}
impl_args->params_arg->str)) {
print_err_oom();
goto error;
}
}
- for (i = 0; i < bt_value_array_size(impl_args->extra_params); i++) {
+ for (i = 0; i < bt_value_array_
get_
size(impl_args->extra_params); i++) {
struct bt_value *elem;
const char *arg;
struct bt_value *elem;
const char *arg;
- elem = bt_value_array_get(impl_args->extra_params, i);
+ elem = bt_value_array_borrow_element_by_index(
+ impl_args->extra_params, i);
if (!elem) {
goto error;
}
if (!elem) {
goto error;
}
@@
-3058,8
+3059,7
@@
int append_run_args_for_implicit_component(
goto error;
}
goto error;
}
- ret = bt_value_array_append_string(run_args, arg);
- bt_put(elem);
+ ret = bt_value_array_append_string_element(run_args, arg);
if (ret) {
print_err_oom();
goto error;
if (ret) {
print_err_oom();
goto error;
@@
-3150,25
+3150,25
@@
int append_implicit_component_extra_param(struct implicit_component_args *args,
BT_ASSERT(key);
BT_ASSERT(value);
BT_ASSERT(key);
BT_ASSERT(value);
- if (bt_value_array_append_string(args->extra_params, "--key")) {
+ if (bt_value_array_append_string
_element
(args->extra_params, "--key")) {
print_err_oom();
ret = -1;
goto end;
}
print_err_oom();
ret = -1;
goto end;
}
- if (bt_value_array_append_string(args->extra_params, key)) {
+ if (bt_value_array_append_string
_element
(args->extra_params, key)) {
print_err_oom();
ret = -1;
goto end;
}
print_err_oom();
ret = -1;
goto end;
}
- if (bt_value_array_append_string(args->extra_params, "--value")) {
+ if (bt_value_array_append_string
_element
(args->extra_params, "--value")) {
print_err_oom();
ret = -1;
goto end;
}
print_err_oom();
ret = -1;
goto end;
}
- if (bt_value_array_append_string(args->extra_params, value)) {
+ if (bt_value_array_append_string
_element
(args->extra_params, value)) {
print_err_oom();
ret = -1;
goto end;
print_err_oom();
ret = -1;
goto end;
@@
-3205,7
+3205,7
@@
int convert_append_name_param(enum bt_config_component_dest dest,
* An explicit name was provided for the user
* component.
*/
* An explicit name was provided for the user
* component.
*/
- if (bt_value_map_has_
ke
y(all_names,
+ if (bt_value_map_has_
entr
y(all_names,
cur_name->str)) {
printf_err("Duplicate component instance name:\n %s\n",
cur_name->str);
cur_name->str)) {
printf_err("Duplicate component instance name:\n %s\n",
cur_name->str);
@@
-3224,7
+3224,7
@@
int convert_append_name_param(enum bt_config_component_dest dest,
* Remember this name globally, for the uniqueness of
* all component names.
*/
* Remember this name globally, for the uniqueness of
* all component names.
*/
- if (bt_value_map_insert(all_names, name->str, bt_value_null)) {
+ if (bt_value_map_insert
_entry
(all_names, name->str, bt_value_null)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-3233,12
+3233,12
@@
int convert_append_name_param(enum bt_config_component_dest dest,
* Append the --name option if necessary.
*/
if (append_name_opt) {
* Append the --name option if necessary.
*/
if (append_name_opt) {
- if (bt_value_array_append_string(run_args, "--name")) {
+ if (bt_value_array_append_string
_element
(run_args, "--name")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, name->str)) {
+ if (bt_value_array_append_string
_element
(run_args, name->str)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-3320,7
+3320,7
@@
int append_connect_arg(struct bt_value *run_args,
goto end;
}
goto end;
}
- ret = bt_value_array_append_string(run_args, "--connect");
+ ret = bt_value_array_append_string
_element
(run_args, "--connect");
if (ret) {
print_err_oom();
ret = -1;
if (ret) {
print_err_oom();
ret = -1;
@@
-3330,7
+3330,7
@@
int append_connect_arg(struct bt_value *run_args,
g_string_append(arg, e_upstream_name->str);
g_string_append_c(arg, ':');
g_string_append(arg, e_downstream_name->str);
g_string_append(arg, e_upstream_name->str);
g_string_append_c(arg, ':');
g_string_append(arg, e_downstream_name->str);
- ret = bt_value_array_append_string(run_args, arg->str);
+ ret = bt_value_array_append_string
_element
(run_args, arg->str);
if (ret) {
print_err_oom();
ret = -1;
if (ret) {
print_err_oom();
ret = -1;
@@
-3776,13
+3776,13
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
abort();
}
abort();
}
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string
_element
(run_args,
"--component")) {
print_err_oom();
goto error;
}
"--component")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string
_element
(run_args, arg)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-3805,13
+3805,13
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string
_element
(run_args,
"--params")) {
print_err_oom();
goto error;
}
"--params")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string
_element
(run_args, arg)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-3823,22
+3823,22
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args, "--key")) {
+ if (bt_value_array_append_string
_element
(run_args, "--key")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "path")) {
+ if (bt_value_array_append_string
_element
(run_args, "path")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "--value")) {
+ if (bt_value_array_append_string
_element
(run_args, "--value")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string
_element
(run_args, arg)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-3850,22
+3850,22
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args, "--key")) {
+ if (bt_value_array_append_string
_element
(run_args, "--key")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "url")) {
+ if (bt_value_array_append_string
_element
(run_args, "url")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "--value")) {
+ if (bt_value_array_append_string
_element
(run_args, "--value")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string
_element
(run_args, arg)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-3877,12
+3877,12
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args, "--name")) {
+ if (bt_value_array_append_string
_element
(run_args, "--name")) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string
_element
(run_args, arg)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-3892,20
+3892,20
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
case OPT_OMIT_HOME_PLUGIN_PATH:
force_omit_home_plugin_path = true;
case OPT_OMIT_HOME_PLUGIN_PATH:
force_omit_home_plugin_path = true;
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string
_element
(run_args,
"--omit-home-plugin-path")) {
print_err_oom();
goto error;
}
break;
case OPT_RETRY_DURATION:
"--omit-home-plugin-path")) {
print_err_oom();
goto error;
}
break;
case OPT_RETRY_DURATION:
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string
_element
(run_args,
"--retry-duration")) {
print_err_oom();
goto error;
}
"--retry-duration")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string
_element
(run_args, arg)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-3913,7
+3913,7
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
case OPT_OMIT_SYSTEM_PLUGIN_PATH:
force_omit_system_plugin_path = true;
case OPT_OMIT_SYSTEM_PLUGIN_PATH:
force_omit_system_plugin_path = true;
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string
_element
(run_args,
"--omit-system-plugin-path")) {
print_err_oom();
goto error;
"--omit-system-plugin-path")) {
print_err_oom();
goto error;
@@
-3925,13
+3925,13
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string
_element
(run_args,
"--plugin-path")) {
print_err_oom();
goto error;
}
"--plugin-path")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string
_element
(run_args, arg)) {
print_err_oom();
goto error;
}
print_err_oom();
goto error;
}
@@
-4667,9
+4667,10
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
goto error;
}
goto error;
}
- for (i = 0; i < bt_value_array_size(run_args); i++) {
+ for (i = 0; i < bt_value_array_
get_
size(run_args); i++) {
struct bt_value *arg_value =
struct bt_value *arg_value =
- bt_value_array_get(run_args, i);
+ bt_value_array_borrow_element_by_index(
+ run_args, i);
const char *arg;
GString *quoted = NULL;
const char *arg_to_print;
const char *arg;
GString *quoted = NULL;
const char *arg_to_print;
@@
-4677,7
+4678,6
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
BT_ASSERT(arg_value);
ret = bt_value_string_get(arg_value, &arg);
BT_ASSERT(ret == 0);
BT_ASSERT(arg_value);
ret = bt_value_string_get(arg_value, &arg);
BT_ASSERT(ret == 0);
- BT_PUT(arg_value);
if (print_run_args) {
quoted = bt_common_shell_quote(arg, true);
if (print_run_args) {
quoted = bt_common_shell_quote(arg, true);
@@
-4696,7
+4696,7
@@
struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
g_string_free(quoted, TRUE);
}
g_string_free(quoted, TRUE);
}
- if (i < bt_value_array_size(run_args) - 1) {
+ if (i < bt_value_array_
get_
size(run_args) - 1) {
if (print_run_args) {
putchar(' ');
} else {
if (print_run_args) {
putchar(' ');
} else {
This page took
0.034206 seconds
and
4
git commands to generate.