end:
return ret;
}
+
+BT_HIDDEN
+int bt_ctf_field_type_variant_set_tag_field_path(struct bt_ctf_field_type *type,
+ struct bt_ctf_field_path *path)
+{
+ int ret = 0;
+ struct bt_ctf_field_type_variant *variant;
+
+ if (!type || bt_ctf_field_type_get_type_id(type) != CTF_TYPE_VARIANT) {
+ ret = -1;
+ goto end;
+ }
+
+ variant = container_of(type, struct bt_ctf_field_type_variant,
+ parent);
+ if (variant->tag_path) {
+ bt_ctf_field_path_destroy(variant->tag_path);
+ }
+ variant->tag_path = path;
+end:
+ return ret;
+}
static
void bt_ctf_field_type_integer_destroy(struct bt_ctf_ref *ref)
{
g_hash_table_destroy(variant->field_name_to_index);
g_string_free(variant->tag_name, TRUE);
bt_ctf_field_type_put(&variant->tag->parent);
+ bt_ctf_field_path_destroy(variant->tag_path);
g_free(variant);
}
}
copy_variant->declaration = variant->declaration;
+ if (variant->tag_path) {
+ copy_variant->tag_path = bt_ctf_field_path_copy(
+ variant->tag_path);
+ if (!copy_variant->tag_path) {
+ goto error;
+ }
+ }
end:
if (copy_tag) {
bt_ctf_field_type_put(copy_tag);
struct bt_ctf_field_type parent;
GString *tag_name;
struct bt_ctf_field_type_enumeration *tag;
+ struct bt_ctf_field_path *tag_path;
GHashTable *field_name_to_index;
GPtrArray *fields; /* Array of pointers to struct structure_field */
struct declaration_variant declaration;
int bt_ctf_field_type_sequence_set_length_field_path(
struct bt_ctf_field_type *type,
struct bt_ctf_field_path *path);
+
+BT_HIDDEN
+int bt_ctf_field_type_variant_set_tag_field_path(struct bt_ctf_field_type *type,
+ struct bt_ctf_field_path *path);
#endif /* BABELTRACE_CTF_IR_EVENT_TYPES_INTERNAL_H */