projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: maybe-uninitialized warning in create_relative_field_ref()
[babeltrace.git]
/
plugins
/
ctf
/
fs-sink
/
translate-trace-ir-to-ctf-ir.c
diff --git
a/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.c
b/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.c
index 9f0026c7bd1574fc8cf22506da25ccf0700e45b2..fe3725f84d73c172795309c63a94743a5c7acaa0 100644
(file)
--- a/
plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.c
+++ b/
plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.c
@@
-154,15
+154,6
@@
void cur_path_stack_pop(struct ctx *ctx)
g_array_set_size(ctx->cur_path, ctx->cur_path->len - 1);
}
g_array_set_size(ctx->cur_path, ctx->cur_path->len - 1);
}
-static inline
-struct field_path_elem *get_field_path_elem(
- GArray *full_field_path, uint64_t i)
-{
- return &g_array_index(full_field_path, struct field_path_elem,
- i);
-}
-
-
/*
* Creates a relative field ref (a single name) from IR field path
* `tgt_ir_field_path`.
/*
* Creates a relative field ref (a single name) from IR field path
* `tgt_ir_field_path`.
@@
-183,7
+174,7
@@
int create_relative_field_ref(struct ctx *ctx,
struct fs_sink_ctf_field_class *tgt_fc = NULL;
uint64_t i;
int64_t si;
struct fs_sink_ctf_field_class *tgt_fc = NULL;
uint64_t i;
int64_t si;
- const char *tgt_fc_name;
+ const char *tgt_fc_name
= NULL
;
struct field_path_elem *field_path_elem;
/* Get target field class's name */
struct field_path_elem *field_path_elem;
/* Get target field class's name */
@@
-210,21
+201,29
@@
int create_relative_field_ref(struct ctx *ctx,
i = 0;
i = 0;
- while (i < bt_field_path_get_index_count(tgt_ir_field_path)) {
- uint64_t index = bt_field_path_get_index_by_index(
- tgt_ir_field_path, i);
+ while (i < bt_field_path_get_item_count(tgt_ir_field_path)) {
+ const bt_field_path_item *fp_item =
+ bt_field_path_borrow_item_by_index_const(
+ tgt_ir_field_path, i);
struct fs_sink_ctf_named_field_class *named_fc = NULL;
BT_ASSERT(tgt_fc);
struct fs_sink_ctf_named_field_class *named_fc = NULL;
BT_ASSERT(tgt_fc);
+ BT_ASSERT(fp_item);
switch (tgt_fc->type) {
case FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT:
switch (tgt_fc->type) {
case FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT:
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_INDEX);
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
- (void *) tgt_fc, index);
+ (void *) tgt_fc,
+ bt_field_path_item_index_get_index(fp_item));
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT:
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT:
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_INDEX);
named_fc = fs_sink_ctf_field_class_variant_borrow_option_by_index(
named_fc = fs_sink_ctf_field_class_variant_borrow_option_by_index(
- (void *) tgt_fc, index);
+ (void *) tgt_fc,
+ bt_field_path_item_index_get_index(fp_item));
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_ARRAY:
case FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE:
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_ARRAY:
case FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE:
@@
-232,6
+231,8
@@
int create_relative_field_ref(struct ctx *ctx,
struct fs_sink_ctf_field_class_array_base *array_base_fc =
(void *) tgt_fc;
struct fs_sink_ctf_field_class_array_base *array_base_fc =
(void *) tgt_fc;
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT);
tgt_fc = array_base_fc->elem_fc;
break;
}
tgt_fc = array_base_fc->elem_fc;
break;
}
@@
-360,25
+361,34
@@
int create_absolute_field_ref(struct ctx *ctx,
BT_ASSERT(fc);
BT_ASSERT(fc);
- for (i = 0; i < bt_field_path_get_index_count(tgt_ir_field_path); i++) {
- uint64_t index = bt_field_path_get_index_by_index(
- tgt_ir_field_path, i);
+ for (i = 0; i < bt_field_path_get_item_count(tgt_ir_field_path); i++) {
+ const bt_field_path_item *fp_item =
+ bt_field_path_borrow_item_by_index_const(
+ tgt_ir_field_path, i);
struct fs_sink_ctf_named_field_class *named_fc = NULL;
struct fs_sink_ctf_named_field_class *named_fc = NULL;
+ if (bt_field_path_item_get_type(fp_item) !=
+ BT_FIELD_PATH_ITEM_TYPE_INDEX) {
+ /* Not supported by TSDL 1.8 */
+ ret = -1;
+ goto end;
+ }
+
switch (fc->type) {
case FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT:
switch (fc->type) {
case FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT:
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_INDEX);
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
- (void *) fc, index);
+ (void *) fc,
+ bt_field_path_item_index_get_index(fp_item));
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT:
break;
case FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT:
+ BT_ASSERT(bt_field_path_item_get_type(fp_item) ==
+ BT_FIELD_PATH_ITEM_TYPE_INDEX);
named_fc = fs_sink_ctf_field_class_variant_borrow_option_by_index(
named_fc = fs_sink_ctf_field_class_variant_borrow_option_by_index(
- (void *) fc, index);
+ (void *) fc,
+ bt_field_path_item_index_get_index(fp_item));
break;
break;
- case FS_SINK_CTF_FIELD_CLASS_TYPE_ARRAY:
- case FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE:
- /* Not supported by TSDL 1.8 */
- ret = -1;
- goto end;
default:
abort();
}
default:
abort();
}
This page took
0.025183 seconds
and
4
git commands to generate.