#include <babeltrace/ctf-ir/stream-class.h>
#include <babeltrace/ctf-ir/resolve-internal.h>
#include <babeltrace/ctf-ir/event-types-internal.h>
+#include <babeltrace/ctf-ir/field-path.h>
+#include <babeltrace/ctf-ir/field-path-internal.h>
#include <babeltrace/ctf-ir/event-internal.h>
#include <babeltrace/ref.h>
#include <babeltrace/babeltrace-internal.h>
}
/* Create new field path entry */
- g_array_append_val(field_path->path_indexes, child_index);
+ g_array_append_val(field_path->indexes, child_index);
/* Get child field type */
child_type = bt_ctf_field_type_get_field_at_index(type,
/* Found: stitch tail field path to head field path */
int i = 0;
int tail_field_path_len =
- tail_field_path->path_indexes->len;
+ tail_field_path->indexes->len;
while (true) {
struct bt_ctf_field_type *cur_type =
break;
}
- g_array_append_val(field_path->path_indexes,
+ g_array_append_val(field_path->indexes,
index);
i++;
}
for (i = 0; i < tail_field_path_len; i++) {
int index = g_array_index(
- tail_field_path->path_indexes,
+ tail_field_path->indexes,
int, i);
- g_array_append_val(field_path->path_indexes,
+ g_array_append_val(field_path->indexes,
index);
}
break;
}
end:
- bt_ctf_field_path_destroy(tail_field_path);
+ BT_PUT(tail_field_path);
return ret;
}
end:
if (ret) {
- bt_ctf_field_path_destroy(field_path);
- field_path = NULL;
+ BT_PUT(field_path);
}
ptokens_destroy(ptokens);
}
/* Locate target */
- for (i = 0; i < field_path->path_indexes->len; i++) {
+ for (i = 0; i < field_path->indexes->len; i++) {
struct bt_ctf_field_type *child_type;
int child_index =
- g_array_index(field_path->path_indexes, int, i);
+ g_array_index(field_path->indexes, int, i);
/* Get child field type */
child_type = bt_ctf_field_type_get_field_at_index(type,
struct type_stack_frame *frame;
frame = type_stack_at(ctx->type_stack, i);
- g_array_append_val(field_path->path_indexes, frame->index);
+ g_array_append_val(field_path->indexes, frame->index);
}
return field_path;
error:
- bt_ctf_field_path_destroy(field_path);
- return NULL;
+ BT_PUT(field_path);
+ return field_path;
}
/*
* Start from both roots and find the first mismatch.
*/
assert(field_path1->root == field_path2->root);
- field_path1_len = field_path1->path_indexes->len;
- field_path2_len = field_path2->path_indexes->len;
+ field_path1_len = field_path1->indexes->len;
+ field_path2_len = field_path2->indexes->len;
while (true) {
int target_index, ctx_index;
break;
}
- target_index = g_array_index(field_path1->path_indexes, int,
+ target_index = g_array_index(field_path1->indexes, int,
lca_index);
- ctx_index = g_array_index(field_path2->path_indexes, int,
+ ctx_index = g_array_index(field_path2->indexes, int,
lca_index);
if (target_index != ctx_index) {
{
int ret = 0;
struct bt_ctf_field_path *ctx_field_path;
- int target_field_path_len = target_field_path->path_indexes->len;
+ int target_field_path_len = target_field_path->indexes->len;
int lca_index;
int ctx_cur_field_type_id;
int target_type_id;
* Make sure the target field path is located before the
* context field path.
*/
- target_index = g_array_index(target_field_path->path_indexes,
+ target_index = g_array_index(target_field_path->indexes,
int, lca_index);
- ctx_index = g_array_index(ctx_field_path->path_indexes,
+ ctx_index = g_array_index(ctx_field_path->indexes,
int, lca_index);
if (target_index >= ctx_index) {
}
end:
- bt_ctf_field_path_destroy(ctx_field_path);
+ BT_PUT(ctx_field_path);
return ret;
}
_printf_error("Cannot set sequence field type's length field path\n");
goto end;
}
-
- target_field_path = NULL;
} else if (type_id == CTF_TYPE_VARIANT) {
ret = bt_ctf_field_type_variant_set_tag_field_path(
type, target_field_path);
goto end;
}
- target_field_path = NULL;
-
ret = bt_ctf_field_type_variant_set_tag_field_type(
type, target_type);
if (ret) {
}
end:
- bt_ctf_field_path_destroy(target_field_path);
+ BT_PUT(target_field_path);
BT_PUT(target_type);
return ret;
}