Add Variant and Sequence IR type validation checks
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Mar 2015 23:24:57 +0000 (18:24 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 16 Mar 2015 19:01:45 +0000 (15:01 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/event-types.c

index 5c091bc76896c210883487dff71b810ba7929995..8bfc1f6153dba67b08c5746701e940c36487eb36 100644 (file)
@@ -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;
        }
This page took 0.029416 seconds and 4 git commands to generate.