X-Git-Url: http://drtracing.org/?a=blobdiff_plain;ds=sidebyside;f=formats%2Fctf%2Fir%2Fevent-fields.c;h=71c4ea173edd02d057cde0d08d226f57bff4c0be;hb=09840de5d022697671dafe2bed427fa5c09b40b9;hp=3358ff0ed0f68af8055b7ab6c8a8436b0b3b0c33;hpb=d9548894df258a8984385470c9c251c99329e01c;p=babeltrace.git diff --git a/formats/ctf/ir/event-fields.c b/formats/ctf/ir/event-fields.c index 3358ff0e..71c4ea17 100644 --- a/formats/ctf/ir/event-fields.c +++ b/formats/ctf/ir/event-fields.c @@ -234,14 +234,22 @@ struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) { struct bt_ctf_field *field = NULL; enum ctf_type_id type_id; + int ret; if (!type) { goto error; } type_id = bt_ctf_field_type_get_type_id(type); - if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES || - bt_ctf_field_type_validate(type)) { + if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) { + goto error; + } + + /* Field class MUST be valid */ + ret = bt_ctf_field_type_validate(type); + + if (ret) { + /* Invalid */ goto error; } @@ -527,7 +535,8 @@ int bt_ctf_field_structure_set_field(struct bt_ctf_field *field, expected_field_type = bt_ctf_field_type_structure_get_field_type_by_name(field->type, name); - if (expected_field_type != value->type) { + + if (bt_ctf_field_type_compare(expected_field_type, value->type)) { ret = -1; goto end; }