From: Jérémie Galarneau Date: Thu, 5 Mar 2015 23:24:57 +0000 (-0500) Subject: Add Variant and Sequence IR type validation checks X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=c6c0ca4289ad129a4e711cb5a31eef23c99cd1b5;p=deliverable%2Fbabeltrace.git Add Variant and Sequence IR type validation checks Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/event-types.c b/formats/ctf/ir/event-types.c index 5c091bc76..8bfc1f615 100644 --- a/formats/ctf/ir/event-types.c +++ b/formats/ctf/ir/event-types.c @@ -382,6 +382,27 @@ int bt_ctf_field_type_validate(struct bt_ctf_field_type *type) 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; }