X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Ffield-path-internal.h;h=f8cb13674a70faea105ce198df4521a338617c1f;hp=907be9b2dcfe17b43f88df4ca43a324e3f8a6957;hb=44c440bc5fe8219cc17d1b786d91fd83c4c9860a;hpb=c800eb3790218d2f33df01e77ec38cbd43cc02a1 diff --git a/include/babeltrace/ctf-ir/field-path-internal.h b/include/babeltrace/ctf-ir/field-path-internal.h index 907be9b2..f8cb1367 100644 --- a/include/babeltrace/ctf-ir/field-path-internal.h +++ b/include/babeltrace/ctf-ir/field-path-internal.h @@ -28,8 +28,8 @@ * http://www.efficios.com/ctf */ -#include #include +#include #include #include @@ -37,23 +37,20 @@ struct bt_field_path { struct bt_object base; enum bt_scope root; - /* - * Array of integers (int) indicating the index in either - * structures, variants, arrays, or sequences that make up - * the path to a field type. -1 means the "current element - * of an array or sequence type". - */ + /* Array of `uint64_t` (indexes) */ GArray *indexes; }; BT_HIDDEN struct bt_field_path *bt_field_path_create(void); -BT_HIDDEN -void bt_field_path_clear(struct bt_field_path *field_path); - -BT_HIDDEN -struct bt_field_path *bt_field_path_copy( - struct bt_field_path *path); +static inline +uint64_t bt_field_path_get_index_by_index_inline( + struct bt_field_path *field_path, uint64_t index) +{ + BT_ASSERT(field_path); + BT_ASSERT(index < field_path->indexes->len); + return g_array_index(field_path->indexes, uint64_t, index); +} #endif /* BABELTRACE_CTF_IR_FIELD_PATH_INTERNAL */