X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fir%2Ffield-types.c;fp=formats%2Fctf%2Fir%2Ffield-types.c;h=7f324c9a47b5c25f5a107e8e4bbf2bdf92e27392;hb=73892edccc428bf4d579a176037b14195b852e63;hp=49919ca2fe008796111955d76655c2f72f733d2a;hpb=dfeca116599b64d433239305d43800103eba48c7;p=babeltrace.git diff --git a/formats/ctf/ir/field-types.c b/formats/ctf/ir/field-types.c index 49919ca2..7f324c9a 100644 --- a/formats/ctf/ir/field-types.c +++ b/formats/ctf/ir/field-types.c @@ -1410,9 +1410,14 @@ int bt_ctf_field_type_structure_add_field(struct bt_ctf_field_type *type, int ret = 0; struct bt_ctf_field_type_structure *structure; + /* + * TODO: check that `field_type` does not contain `type`, + * recursively. + */ if (!type || !field_type || type->frozen || bt_ctf_validate_identifier(field_name) || - (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) { + (type->declaration->id != BT_CTF_TYPE_ID_STRUCT) || + type == field_type) { ret = -1; goto end; } @@ -1615,9 +1620,14 @@ int bt_ctf_field_type_variant_add_field(struct bt_ctf_field_type *type, struct bt_ctf_field_type_variant *variant; GQuark field_name_quark = g_quark_from_string(field_name); + /* + * TODO: check that `field_type` does not contain `type`, + * recursively. + */ if (!type || !field_type || type->frozen || bt_ctf_validate_identifier(field_name) || - (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) { + (type->declaration->id != BT_CTF_TYPE_ID_VARIANT) || + type == field_type) { ret = -1; goto end; }