Fix: Return a variant's alignment as 0 (undefined).
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 22 May 2015 20:31:59 +0000 (16:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 22 May 2015 20:33:21 +0000 (16:33 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/event-types.c
include/babeltrace/ctf-ir/event-types.h

index b336889b029efb208c525a17fb32e44b4301f048..91ab78c86bc05a8196daab4ec2f95f34e9d21c8e 100644 (file)
@@ -1286,6 +1286,8 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_create(
        }
 
        bt_ctf_field_type_init(&variant->parent);
+       /* A variant's alignment is undefined */
+       variant->parent.declaration->alignment = 0;
        return &variant->parent;
 error:
        return NULL;
index 2006943536491b25e9f1b8731ade15e70328b2fe..fdec2e07bb6bc1f92ea2ac8df751f7246b707e69 100644 (file)
@@ -697,7 +697,8 @@ extern int bt_ctf_field_type_string_set_encoding(
  *
  * @param type Field type.
  *
- * Returns the field type's alignment on success, a negative value on error.
+ * Returns the field type's alignment on success, a negative value on error and
+ * 0 if the alignment is undefined (as in the case of a variant).
  */
 extern int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type);
 
This page took 0.025697 seconds and 4 git commands to generate.