Fix: bt_ctf_field_type_floating_point_copy(): set self references
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 30 Jan 2016 06:22:57 +0000 (01:22 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 19 Feb 2016 20:15:46 +0000 (15:15 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/event-types.c
include/babeltrace/ctf-ir/event-types-internal.h

index c750d2187a12a5534579d6f4d29a27b48f9f7651..761b2c26aae439f99d99255b6c0e5535db60fce0 100644 (file)
@@ -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 = &copy_float->sign;
+       copy_float->declaration.mantissa = &copy_float->mantissa;
+       copy_float->declaration.exp = &copy_float->exp;
 end:
        return copy;
 }
index ec114eb00369f8412f8d6b4f00dbc5dd058676d2..5bc46c4ee427f3753b53b93f0d1f9e02febd0e01 100644 (file)
@@ -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;
This page took 0.02632 seconds and 4 git commands to generate.