return;
}
- if (type->alias_name) {
- g_string_free(type->alias_name, TRUE);
- }
type_destroy_funcs[type_id](ref);
}
ret = enumeration->entries->len ? 0 : -1;
break;
}
+ case CTF_TYPE_SEQUENCE:
+ {
+ struct bt_ctf_field_type_sequence *sequence =
+ container_of(type, struct bt_ctf_field_type_sequence,
+ parent);
+
+ /* length field name should be set at this point */
+ ret = sequence->length_field_name->len ? 0 : -1;
+ break;
+ }
+ case CTF_TYPE_VARIANT:
+ {
+ struct bt_ctf_field_type_variant *variant =
+ container_of(type, struct bt_ctf_field_type_variant,
+ parent);
+
+ if (variant->tag_name->len == 0 || !variant->tag) {
+ ret = -1;
+ }
+ break;
+ }
default:
break;
}
return tag_name;
}
+int bt_ctf_field_type_variant_set_tag_name(
+ struct bt_ctf_field_type *type, const char *name)
+{
+ int ret = 0;
+ struct bt_ctf_field_type_variant *variant;
+
+ if (!type || type->frozen ||
+ (type->declaration->id != CTF_TYPE_VARIANT) ||
+ bt_ctf_validate_identifier(name)) {
+ ret = -1;
+ goto end;
+ }
+
+ variant = container_of(type, struct bt_ctf_field_type_variant, parent);
+ g_string_assign(variant->tag_name, name);
+end:
+ return ret;
+}
+
int bt_ctf_field_type_variant_add_field(struct bt_ctf_field_type *type,
struct bt_ctf_field_type *field_type,
const char *field_name)
goto end;
}
- type_id = type->declaration->id;
switch (byte_order) {
case BT_CTF_BYTE_ORDER_NATIVE:
/* Leave unset. Will be initialized by parent. */
goto end;
}
+ type_id = type->declaration->id;
if (set_byte_order_funcs[type_id]) {
set_byte_order_funcs[type_id](type, internal_byte_order, 0);
}
return type->declaration->id;
}
-const char *bt_ctf_field_type_get_alias_name(
- struct bt_ctf_field_type *type)
-{
- const char *name = NULL;
-
- if (!type || !type->alias_name) {
- goto end;
- }
-
- name = type->alias_name->str;
-end:
- return name;
-}
-
void bt_ctf_field_type_get(struct bt_ctf_field_type *type)
{
if (!type) {