From: Philippe Proulx Date: Sat, 30 Jan 2016 06:22:57 +0000 (-0500) Subject: Fix: bt_ctf_field_type_floating_point_copy(): set self references X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=d480b699c96186b69cb91eac28e8f3128fdec7bb;hp=265e809cb65022c2d9f15c0ddc0d607445621b76;p=babeltrace.git Fix: bt_ctf_field_type_floating_point_copy(): set self references Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/event-types.c b/formats/ctf/ir/event-types.c index c750d218..761b2c26 100644 --- a/formats/ctf/ir/event-types.c +++ b/formats/ctf/ir/event-types.c @@ -3236,6 +3236,9 @@ struct bt_ctf_field_type *bt_ctf_field_type_floating_point_copy( copy_float->mantissa = floating_point->mantissa; copy_float->exp = floating_point->exp; copy_float->user_byte_order = floating_point->user_byte_order; + copy_float->declaration.sign = ©_float->sign; + copy_float->declaration.mantissa = ©_float->mantissa; + copy_float->declaration.exp = ©_float->exp; end: return copy; } diff --git a/include/babeltrace/ctf-ir/event-types-internal.h b/include/babeltrace/ctf-ir/event-types-internal.h index ec114eb0..5bc46c4e 100644 --- a/include/babeltrace/ctf-ir/event-types-internal.h +++ b/include/babeltrace/ctf-ir/event-types-internal.h @@ -110,6 +110,12 @@ struct bt_ctf_field_type_enumeration { struct bt_ctf_field_type_floating_point { struct bt_ctf_field_type parent; struct declaration_float declaration; + + /* + * The `declaration` field above contains 3 pointers pointing + * to the fields below. This avoids unnecessary dynamic + * allocations. + */ struct declaration_integer sign; struct declaration_integer mantissa; struct declaration_integer exp;