From d480b699c96186b69cb91eac28e8f3128fdec7bb Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Sat, 30 Jan 2016 01:22:57 -0500 Subject: [PATCH] Fix: bt_ctf_field_type_floating_point_copy(): set self references MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/event-types.c | 3 +++ include/babeltrace/ctf-ir/event-types-internal.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/formats/ctf/ir/event-types.c b/formats/ctf/ir/event-types.c index c750d2187..761b2c26a 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 ec114eb00..5bc46c4ee 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; -- 2.34.1