extern const char *bt_value_string_get(const bt_value *string_obj);
-extern uint64_t bt_value_array_get_size(const bt_value *array_obj);
+extern uint64_t bt_value_array_get_length(const bt_value *array_obj);
static inline
bt_bool bt_value_array_is_empty(const bt_value *array_obj)
{
- return bt_value_array_get_size(array_obj) == 0;
+ return bt_value_array_get_length(array_obj) == 0;
}
extern const bt_value *bt_value_array_borrow_element_by_index_const(
static
const bt_value *borrow_array_value_last_element_const(const bt_value *array)
{
- uint64_t last_index = bt_value_array_get_size(array) - 1;
+ uint64_t last_index = bt_value_array_get_length(array) - 1;
return bt_value_array_borrow_element_by_index_const(array, last_index);
}
uint64_t i_inputs, input_count;
int status;
- input_count = bt_value_array_get_size(inputs);
+ input_count = bt_value_array_get_length(inputs);
for (i_inputs = 0; i_inputs < input_count; i_inputs++) {
const bt_value *input_value;
bt_value_map_insert_entry_status insert_entry_status;
BT_ASSERT(bt_value_get_type(inputs) == BT_VALUE_TYPE_ARRAY);
- for (i = 0; i < bt_value_array_get_size(inputs); i++) {
+ for (i = 0; i < bt_value_array_get_length(inputs); i++) {
const bt_value *elem = bt_value_array_borrow_element_by_index_const(inputs, i);
BT_ASSERT(bt_value_get_type(elem) == BT_VALUE_TYPE_STRING);
}
return True
def __len__(self):
- size = native_bt.value_array_get_size(self._ptr)
+ size = native_bt.value_array_get_length(self._ptr)
assert size >= 0
return size
goto error;
}
- for (i = 0; i < bt_value_array_get_size(connection_args); i++) {
+ for (i = 0; i < bt_value_array_get_length(connection_args); i++) {
const bt_value *arg_value =
bt_value_array_borrow_element_by_index_const(
connection_args, i);
goto end;
}
- for (i = 0; i < bt_value_array_get_size(names_array); i++) {
+ for (i = 0; i < bt_value_array_get_length(names_array); i++) {
const bt_value *str_obj =
bt_value_array_borrow_element_by_index_const(names_array,
i);
struct bt_config *cfg = NULL;
const char **argv;
int64_t i, len;
- const size_t argc = bt_value_array_get_size(run_args);
+ const size_t argc = bt_value_array_get_length(run_args);
argv = calloc(argc, sizeof(*argv));
if (!argv) {
goto end;
}
- len = bt_value_array_get_size(run_args);
+ len = bt_value_array_get_length(run_args);
if (len < 0) {
BT_CLI_LOGE_APPEND_CAUSE("Invalid executable arguments.");
goto end;
}
}
- for (i = 0; i < bt_value_array_get_size(impl_args->extra_params);
+ for (i = 0; i < bt_value_array_get_length(impl_args->extra_params);
i++) {
const bt_value *elem;
const char *arg;
}
case BT_VALUE_TYPE_ARRAY: {
g_string_append_c(buf, '[');
- uint64_t sz = bt_value_array_get_size(value);
+ uint64_t sz = bt_value_array_get_length(value);
for (uint64_t i = 0; i < sz; i++) {
const bt_value *item;
int ret;
* non-option arguments that contributed to this
* component instance coming into existence.
*/
- orig_indices_count = bt_value_array_get_size(res->original_input_indices);
+ orig_indices_count = bt_value_array_get_length(res->original_input_indices);
for (orig_indices_i = 0; orig_indices_i < orig_indices_count; orig_indices_i++) {
const bt_value *orig_idx_value =
bt_value_array_borrow_element_by_index(
uint64_t params_i, params_count;
const bt_value *loglevel_value;
- params_count = bt_value_array_get_size(params_array);
+ params_count = bt_value_array_get_length(params_array);
for (params_i = 0; params_i < params_count; params_i++) {
const bt_value *params_value =
bt_value_array_borrow_element_by_index_const(
* it in `non_opt_params`.
*/
bt_value *array;
- uint64_t idx = bt_value_array_get_size(non_opt_params) - 1;
+ uint64_t idx = bt_value_array_get_length(non_opt_params) - 1;
array = bt_value_array_borrow_element_by_index(non_opt_params, idx);
bt_value_array_append_string_element(array, arg);
goto error;
}
} else if (current_item_type == CONVERT_CURRENT_ITEM_TYPE_NON_OPT) {
- uint64_t idx = bt_value_array_get_size(non_opt_loglevels) - 1;
+ uint64_t idx = bt_value_array_get_length(non_opt_loglevels) - 1;
bt_value *log_level_str_value;
log_level_str_value = bt_value_string_create_init(arg);
goto error;
}
- if (bt_value_array_get_size(non_opts) > 1) {
+ if (bt_value_array_get_length(non_opts) > 1) {
BT_CLI_LOGE_APPEND_CAUSE("Too many paths specified for --output-format=ctf-metadata.");
goto error;
}
}
/* Decide where the non-option argument(s) go */
- if (bt_value_array_get_size(non_opts) > 0) {
+ if (bt_value_array_get_length(non_opts) > 0) {
if (implicit_lttng_live_args.exists) {
const bt_value *bt_val_non_opt;
- if (bt_value_array_get_size(non_opts) > 1) {
+ if (bt_value_array_get_length(non_opts) > 1) {
BT_CLI_LOGE_APPEND_CAUSE("Too many URLs specified for --input-format=lttng-live.");
goto error;
}
goto error;
}
- for (i = 0; i < bt_value_array_get_size(run_args); i++) {
+ for (i = 0; i < bt_value_array_get_length(run_args); i++) {
const bt_value *arg_value =
bt_value_array_borrow_element_by_index(run_args,
i);
g_string_free(quoted, TRUE);
}
- if (i < bt_value_array_get_size(run_args) - 1) {
+ if (i < bt_value_array_get_length(run_args) - 1) {
if (print_run_args) {
putchar(' ');
} else {
{
int nr_paths, i, ret = 0;
- nr_paths = bt_value_array_get_size(plugin_paths);
+ nr_paths = bt_value_array_get_length(plugin_paths);
if (nr_paths < 0) {
BT_CLI_LOGE_APPEND_CAUSE(
"Cannot load dynamic plugins: no plugin path.");
bt_common_color_reset());
break;
case BT_VALUE_TYPE_ARRAY:
- size = bt_value_array_get_size(value);
+ size = bt_value_array_get_length(value);
if (size < 0) {
goto error;
}
}
}
- array_size = bt_value_array_get_size(results);
+ array_size = bt_value_array_get_length(results);
for (i = 0; i < array_size; i++) {
const char *url_text;
int64_t timer_us, streams, clients;
goto error;
}
- trace_count = bt_value_array_get_size(query_result);
+ trace_count = bt_value_array_get_length(query_result);
if (trace_count < 0) {
ret = -1;
goto error;
goto error;
}
- stream_count = bt_value_array_get_size(stream_infos);
+ stream_count = bt_value_array_get_length(stream_infos);
if (stream_count < 0) {
ret = -1;
goto error;
BT_HIDDEN
int64_t bt_ctf_attributes_get_count(struct bt_ctf_private_value *attr_obj)
{
- return bt_ctf_value_array_get_size(bt_ctf_private_value_as_value(attr_obj));
+ return bt_ctf_value_array_get_length(bt_ctf_private_value_as_value(attr_obj));
}
BT_HIDDEN
goto end;
}
- if (index >= bt_ctf_value_array_get_size(bt_ctf_private_value_as_value(attr_obj))) {
+ if (index >= bt_ctf_value_array_get_length(bt_ctf_private_value_as_value(attr_obj))) {
BT_LOGW("Invalid parameter: index is out of bounds: "
"index=%" PRIu64 ", count=%" PRId64,
- index, bt_ctf_value_array_get_size(bt_ctf_private_value_as_value(attr_obj)));
+ index, bt_ctf_value_array_get_length(bt_ctf_private_value_as_value(attr_obj)));
goto end;
}
goto end;
}
- if (index >= bt_ctf_value_array_get_size(bt_ctf_private_value_as_value(attr_obj))) {
+ if (index >= bt_ctf_value_array_get_length(bt_ctf_private_value_as_value(attr_obj))) {
BT_LOGW("Invalid parameter: index is out of bounds: "
"index=%" PRIu64 ", count=%" PRId64,
- index, bt_ctf_value_array_get_size(bt_ctf_private_value_as_value(attr_obj)));
+ index, bt_ctf_value_array_get_length(bt_ctf_private_value_as_value(attr_obj)));
goto end;
}
struct bt_ctf_private_value *value_obj = NULL;
struct bt_ctf_private_value *attr_field_name_obj = NULL;
- attr_size = bt_ctf_value_array_get_size(bt_ctf_private_value_as_value(attr_obj));
+ attr_size = bt_ctf_value_array_get_length(bt_ctf_private_value_as_value(attr_obj));
if (attr_size < 0) {
BT_LOGE("Cannot get array value's size: value-addr=%p",
attr_obj);
}
BT_LOGD("Freezing attributes object: value-addr=%p", attr_obj);
- count = bt_ctf_value_array_get_size(bt_ctf_private_value_as_value(attr_obj));
+ count = bt_ctf_value_array_get_length(bt_ctf_private_value_as_value(attr_obj));
BT_ASSERT(count >= 0);
/*
const struct bt_ctf_value_array *array_obj_a =
BT_CTF_VALUE_TO_ARRAY(object_a);
- if (bt_ctf_value_array_get_size(object_a) !=
- bt_ctf_value_array_get_size(object_b)) {
+ if (bt_ctf_value_array_get_length(object_a) !=
+ bt_ctf_value_array_get_length(object_b)) {
BT_LOGT("Array values are different: size mismatch "
"value-a-addr=%p, value-b-addr=%p, "
"value-a-size=%" PRId64 ", value-b-size=%" PRId64,
object_a, object_b,
- bt_ctf_value_array_get_size(object_a),
- bt_ctf_value_array_get_size(object_b));
+ bt_ctf_value_array_get_length(object_a),
+ bt_ctf_value_array_get_length(object_b));
ret = BT_CTF_FALSE;
goto end;
}
}
BT_HIDDEN
-uint64_t bt_ctf_value_array_get_size(const struct bt_ctf_value *array_obj)
+uint64_t bt_ctf_value_array_get_length(const struct bt_ctf_value *array_obj)
{
BT_CTF_ASSERT_PRE_NON_NULL(array_obj, "Value object");
BT_CTF_ASSERT_PRE_VALUE_IS_TYPE(array_obj, BT_CTF_VALUE_TYPE_ARRAY);
const char *bt_ctf_value_string_get(const struct bt_ctf_value *string_obj);
BT_HIDDEN
-uint64_t bt_ctf_value_array_get_size(const struct bt_ctf_value *array_obj);
+uint64_t bt_ctf_value_array_get_length(const struct bt_ctf_value *array_obj);
static inline
bt_ctf_bool bt_ctf_value_array_is_empty(const struct bt_ctf_value *array_obj)
{
- return bt_ctf_value_array_get_size(array_obj) == 0;
+ return bt_ctf_value_array_get_length(array_obj) == 0;
}
BT_HIDDEN
}
case BT_VALUE_TYPE_ARRAY:
{
- int64_t count = bt_value_array_get_size(value);
+ int64_t count = bt_value_array_get_length(value);
BT_ASSERT(count >= 0);
BUF_APPEND(", %selement-count=%" PRId64, PRFIELD(count));
BT_HIDDEN
int64_t bt_attributes_get_count(const struct bt_value *attr_obj)
{
- return bt_value_array_get_size(attr_obj);
+ return bt_value_array_get_length(attr_obj);
}
BT_HIDDEN
const struct bt_value *attr_field_name_obj = NULL;
BT_ASSERT(attr_obj);
- BT_ASSERT(index < bt_value_array_get_size(attr_obj));
+ BT_ASSERT(index < bt_value_array_get_length(attr_obj));
attr_field_obj = bt_value_array_borrow_element_by_index_const(
attr_obj, index);
if (!attr_field_obj) {
struct bt_value *attr_field_obj = NULL;
BT_ASSERT(attr_obj);
- BT_ASSERT(index < bt_value_array_get_size(attr_obj));
+ BT_ASSERT(index < bt_value_array_get_length(attr_obj));
attr_field_obj =
bt_value_array_borrow_element_by_index(attr_obj, index);
if (!attr_field_obj) {
struct bt_value *value_obj = NULL;
struct bt_value *attr_field_name_obj = NULL;
- attr_size = bt_value_array_get_size(attr_obj);
+ attr_size = bt_value_array_get_length(attr_obj);
if (attr_size < 0) {
BT_LIB_LOGE_APPEND_CAUSE(
"Cannot get array value's size: %![value-]+v",
BT_ASSERT(attr_obj);
BT_LOGD("Freezing attributes object: value-addr=%p", attr_obj);
- count = bt_value_array_get_size(attr_obj);
+ count = bt_value_array_get_length(attr_obj);
BT_ASSERT(count >= 0);
/*
const struct bt_value_array *array_obj_a =
BT_VALUE_TO_ARRAY(object_a);
- if (bt_value_array_get_size(object_a) !=
- bt_value_array_get_size(object_b)) {
+ if (bt_value_array_get_length(object_a) !=
+ bt_value_array_get_length(object_b)) {
BT_LOGT("Array values are different: size mismatch "
"value-a-addr=%p, value-b-addr=%p, "
"value-a-size=%" PRId64 ", value-b-size=%" PRId64,
object_a, object_b,
- bt_value_array_get_size(object_a),
- bt_value_array_get_size(object_b));
+ bt_value_array_get_length(object_a),
+ bt_value_array_get_length(object_b));
ret = BT_FALSE;
goto end;
}
return BT_FUNC_STATUS_OK;
}
-uint64_t bt_value_array_get_size(const struct bt_value *array_obj)
+uint64_t bt_value_array_get_length(const struct bt_value *array_obj)
{
BT_ASSERT_PRE_DEV_NON_NULL(array_obj, "Value object");
BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
int ret = 0;
uint64_t i;
- for (i = 0; i < bt_value_array_get_size(paths_value); i++) {
+ for (i = 0; i < bt_value_array_get_length(paths_value); i++) {
const bt_value *path_value = bt_value_array_borrow_element_by_index_const(paths_value, i);
const char *input = bt_value_string_get(path_value);
goto error;
}
- for (i = 0; i < bt_value_array_get_size(inputs); i++) {
+ for (i = 0; i < bt_value_array_get_length(inputs); i++) {
const bt_value *elem;
elem = bt_value_array_borrow_element_by_index_const(inputs, i);
int i, len;
bool found = false;
- len = bt_value_array_get_size(results);
+ len = bt_value_array_get_length(results);
if (len < 0) {
BT_COMP_LOGE_STR("Error getting size of array.");
ret = -1;
break;
case BT_VALUE_TYPE_ARRAY:
{
- uint64_t length = bt_value_array_get_size(value);
+ uint64_t length = bt_value_array_get_length(value);
if (length == 0) {
write_sp(ctx);
BT_ASSERT(query_exec);
ret = bt_query_executor_query(query_exec, &results);
ok(ret == 0 && results, "bt_query_executor_query() succeeds");
- BT_ASSERT(bt_value_is_array(results) && bt_value_array_get_size(results) == 2);
+ BT_ASSERT(bt_value_is_array(results) && bt_value_array_get_length(results) == 2);
object = bt_value_array_borrow_element_by_index_const(results, 0);
BT_ASSERT(object && bt_value_is_string(object));
object_str = bt_value_string_get(object);
ret |= bt_value_array_append_element(array_obj,
bt_value_null);
ok(!ret, "bt_value_array_append_element() succeeds");
- ok(bt_value_array_get_size(array_obj) == 5,
+ ok(bt_value_array_get_length(array_obj) == 5,
"appending an element to an array value object increment its size");
obj = bt_value_array_borrow_element_by_index(array_obj, 0);
ret = bt_value_array_append_empty_map_element(array_obj);
ok(!ret, "bt_value_array_append_empty_map_element() succeeds");
- ok(bt_value_array_get_size(array_obj) == 12,
+ ok(bt_value_array_get_length(array_obj) == 12,
"the bt_value_array_append_element_*() functions increment the array value object's size");
ok(!bt_value_array_is_empty(array_obj),
"map value object is not empty");
BT_ASSERT(append_status == BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK);
append_status = bt_value_array_append_bool_element(array3, BT_FALSE);
BT_ASSERT(append_status == BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK);
- BT_ASSERT(bt_value_array_get_size(array1) == 3);
- BT_ASSERT(bt_value_array_get_size(array2) == 3);
- BT_ASSERT(bt_value_array_get_size(array3) == 3);
+ BT_ASSERT(bt_value_array_get_length(array1) == 3);
+ BT_ASSERT(bt_value_array_get_length(array2) == 3);
+ BT_ASSERT(bt_value_array_get_length(array3) == 3);
ok(!bt_value_compare(bt_value_null,
array1),