return current_field;
}
+struct bt_ctf_field *bt_ctf_field_variant_get_tag(
+ struct bt_ctf_field *variant_field)
+{
+ struct bt_ctf_field *tag = NULL;
+ struct bt_ctf_field_variant *variant;
+
+ if (!variant_field ||
+ bt_ctf_field_type_get_type_id(variant_field->type) !=
+ BT_CTF_TYPE_ID_VARIANT) {
+ goto end;
+ }
+
+ variant = container_of(variant_field, struct bt_ctf_field_variant,
+ parent);
+ if (variant->tag) {
+ tag = bt_get(variant->tag);
+ }
+end:
+ return tag;
+}
+
struct bt_ctf_field *bt_ctf_field_enumeration_get_container(
struct bt_ctf_field *field)
{
for (i = 0; i < structure->fields->len; i++) {
ret = bt_ctf_field_validate(structure->fields->pdata[i]);
if (ret) {
+ const char *name;
+ struct bt_ctf_field_type *field_type =
+ bt_ctf_field_get_type(field);
+
+ (void) bt_ctf_field_type_structure_get_field(field_type,
+ &name, NULL, i);
+ fprintf(stderr, "Field %s failed validation\n",
+ name ? name : "NULL");
+ bt_put(field_type);
goto end;
}
}
for (i = 0; i < sequence->elements->len; i++) {
ret = bt_ctf_field_validate(sequence->elements->pdata[i]);
if (ret) {
+ fprintf(stderr, "Failed to validate sequence field %zu\n", i);
goto end;
}
}