From: Jérémie Galarneau Date: Fri, 22 May 2015 20:31:59 +0000 (-0400) Subject: Fix: Return a variant's alignment as 0 (undefined). X-Git-Tag: v2.0.0-pre1~1229 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=46caf2cb05e3c88e0c42a8507aeb524b8d2fc6df Fix: Return a variant's alignment as 0 (undefined). Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/event-types.c b/formats/ctf/ir/event-types.c index b336889b..91ab78c8 100644 --- a/formats/ctf/ir/event-types.c +++ b/formats/ctf/ir/event-types.c @@ -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; diff --git a/include/babeltrace/ctf-ir/event-types.h b/include/babeltrace/ctf-ir/event-types.h index 20069435..fdec2e07 100644 --- a/include/babeltrace/ctf-ir/event-types.h +++ b/include/babeltrace/ctf-ir/event-types.h @@ -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);