ir: empty structures are legal in CTF
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 30 Jul 2015 19:31:38 +0000 (15:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 30 Jul 2015 23:06:32 +0000 (19:06 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/event-fields.c
formats/ctf/ir/visitor.c

index 829a44758c4a2d55224879d4f946dd88afdd78e8..1092dc314d9d8ac08ab39476f39a5afcd1f16daa 100644 (file)
@@ -1257,7 +1257,7 @@ struct bt_ctf_field *bt_ctf_field_structure_create(
                struct bt_ctf_field_structure, 1);
        struct bt_ctf_field *field = NULL;
 
-       if (!structure || !structure_type->fields->len) {
+       if (!structure) {
                goto end;
        }
 
index 62195b64adb6f3e7561b88e585686c287f29efb3..9b65ed58e62ce29b721dcb3ffc78808f87714a91 100644 (file)
@@ -273,10 +273,11 @@ int field_type_recursive_visit(struct bt_ctf_field_type *type,
                        ctf_type_stack_peek(context->stack);
                int field_count = get_type_field_count(entry->type);
 
-               if (field_count <= 0) {
+               if (field_count <= 0 &&
+                               !bt_ctf_field_type_is_structure(entry->type)) {
                        /*
                         * Propagate error if one was given, else return
-                        * -1 since empty structures or variants are invalid
+                        * -1 since empty variants are invalid
                         * at this point.
                         */
                        ret = field_count < 0 ? field_count : -1;
This page took 0.025759 seconds and 4 git commands to generate.