tests: Move libtestcommon to utils
[babeltrace.git] / tests / lib / test_ctf_writer.c
index 5601809136548b4c0af5f9107435af9545950c8f..1ed4cc6737d764f730c1b8d2b7e00215b1be392e 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <babeltrace/ctf-writer/writer.h>
-#include <babeltrace/ctf-writer/clock.h>
-#include <babeltrace/ctf-writer/stream.h>
-#include <babeltrace/ctf-writer/event.h>
-#include <babeltrace/ctf-writer/event-types.h>
-#include <babeltrace/ctf-writer/event-fields.h>
-#include <babeltrace/ctf-writer/stream-class.h>
-#include <babeltrace/ctf-writer/trace.h>
-#include <babeltrace/ref.h>
-#include <babeltrace/ctf/events.h>
-#include <babeltrace/values.h>
+#include <babeltrace2/ctf-writer/writer.h>
+#include <babeltrace2/ctf-writer/clock.h>
+#include <babeltrace2/ctf-writer/clock-class.h>
+#include <babeltrace2/ctf-writer/stream.h>
+#include <babeltrace2/ctf-writer/event.h>
+#include <babeltrace2/ctf-writer/event-types.h>
+#include <babeltrace2/ctf-writer/event-fields.h>
+#include <babeltrace2/ctf-writer/stream-class.h>
+#include <babeltrace2/ctf-writer/trace.h>
+#include <babeltrace2/ctf/events.h>
+#include <babeltrace2/value.h>
 #include <glib.h>
 #include <unistd.h>
-#include <babeltrace/compat/stdlib-internal.h>
+#include "compat/stdlib.h"
 #include <stdio.h>
-#include <babeltrace/compat/limits-internal.h>
-#include <babeltrace/compat/stdio-internal.h>
+#include "compat/limits.h"
+#include "compat/stdio.h"
 #include <string.h>
-#include <assert.h>
+#include "common/assert.h"
 #include <fcntl.h>
 #include "tap/tap.h"
 #include <math.h>
@@ -57,7 +57,7 @@
 #define DEFAULT_CLOCK_TIME 0
 #define DEFAULT_CLOCK_VALUE 0
 
-#define NR_TESTS 347
+#define NR_TESTS 325
 
 struct bt_utsname {
        char sysname[BABELTRACE_HOST_NAME_MAX];
@@ -193,7 +193,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        ok(returned_type == int_64_type, "bt_ctf_field_type_enumeration_get_container_field_type returns the right type");
        ok(!bt_ctf_field_type_enumeration_create(enum_type),
                "bt_ctf_field_enumeration_type_create rejects non-integer container field types");
-       bt_put(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        bt_ctf_field_type_set_alignment(float_type, 32);
        ok(bt_ctf_field_type_get_alignment(float_type) == 32,
@@ -301,7 +301,8 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        bt_ctf_event_class_add_field(simple_event_class, float_type,
                "float_field");
 
-       assert(!bt_ctf_event_class_set_id(simple_event_class, 13));
+       ret = bt_ctf_event_class_set_id(simple_event_class, 13);
+       BT_ASSERT(ret == 0);
 
        /* Set an event context type which will contain a single integer. */
        ok(!bt_ctf_field_type_structure_add_field(event_context_type, uint_12_type,
@@ -315,7 +316,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        returned_type = bt_ctf_event_class_get_context_field_type(simple_event_class);
        ok(returned_type == event_context_type,
                "bt_ctf_event_class_get_context_field_type returns the appropriate type");
-       bt_put(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        ok(!bt_ctf_stream_class_add_event_class(stream_class, simple_event_class),
                "Adding simple event class to stream class");
@@ -325,40 +326,40 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
         * of simple_event_class, so we retrieve the new ones to create
         * the appropriate fields.
         */
-       BT_PUT(event_context_type);
-       BT_PUT(event_payload_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(event_context_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(event_payload_type);
        event_payload_type = bt_ctf_event_class_get_payload_field_type(
                simple_event_class);
-       assert(event_payload_type);
+       BT_ASSERT(event_payload_type);
        event_context_type = bt_ctf_event_class_get_context_field_type(
                simple_event_class);
-       assert(event_context_type);
+       BT_ASSERT(event_context_type);
        ep_integer_field_type =
                bt_ctf_field_type_structure_get_field_type_by_name(
                        event_payload_type, "integer_field");
-       assert(ep_integer_field_type);
+       BT_ASSERT(ep_integer_field_type);
        ep_enum_field_type =
                bt_ctf_field_type_structure_get_field_type_by_name(
                        event_payload_type, "enum_field");
-       assert(ep_enum_field_type);
+       BT_ASSERT(ep_enum_field_type);
        ep_enum_field_unsigned_type =
                bt_ctf_field_type_structure_get_field_type_by_name(
                        event_payload_type, "enum_field_unsigned");
-       assert(ep_enum_field_unsigned_type);
+       BT_ASSERT(ep_enum_field_unsigned_type);
 
        ok(bt_ctf_stream_class_get_event_class_count(stream_class) == 1,
                "bt_ctf_stream_class_get_event_class_count returns a correct number of event classes");
        ret_event_class = bt_ctf_stream_class_get_event_class_by_index(stream_class, 0);
        ok(ret_event_class == simple_event_class,
                "bt_ctf_stream_class_get_event_class returns the correct event class");
-       bt_put(ret_event_class);
+       bt_ctf_object_put_ref(ret_event_class);
        ok(!bt_ctf_stream_class_get_event_class_by_id(stream_class, 2),
                "bt_ctf_stream_class_get_event_class_by_id returns NULL when the requested ID doesn't exist");
        ret_event_class =
                bt_ctf_stream_class_get_event_class_by_id(stream_class, 13);
        ok(ret_event_class == simple_event_class,
                "bt_ctf_stream_class_get_event_class_by_id returns a correct event class");
-       bt_put(ret_event_class);
+       bt_ctf_object_put_ref(ret_event_class);
 
        simple_event = bt_ctf_event_create(simple_event_class);
        ok(simple_event,
@@ -377,18 +378,18 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_field_floating_point_get_value returns a correct value");
 
        enum_field = bt_ctf_field_create(ep_enum_field_type);
-       assert(enum_field);
+       BT_ASSERT(enum_field);
 
        enum_container_field = bt_ctf_field_enumeration_get_container(enum_field);
        ok(bt_ctf_field_integer_signed_set_value(
                enum_container_field, -42) == 0,
                "Set signed enumeration container value");
        ret = bt_ctf_event_set_payload(simple_event, "enum_field", enum_field);
-       assert(!ret);
-       BT_PUT(iter);
+       BT_ASSERT(!ret);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(iter);
 
        enum_field_unsigned = bt_ctf_field_create(ep_enum_field_unsigned_type);
-       assert(enum_field_unsigned);
+       BT_ASSERT(enum_field_unsigned);
        enum_container_field_unsigned = bt_ctf_field_enumeration_get_container(
                enum_field_unsigned);
        ok(bt_ctf_field_integer_unsigned_set_value(
@@ -396,14 +397,14 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
                "Set unsigned enumeration container value");
        ret = bt_ctf_event_set_payload(simple_event, "enum_field_unsigned",
                enum_field_unsigned);
-       assert(!ret);
+       BT_ASSERT(!ret);
 
        ok(bt_ctf_clock_set_time(clock, current_time) == 0, "Set clock time");
 
        /* Populate stream event context */
        stream_event_context =
                bt_ctf_event_get_stream_event_context(simple_event);
-       assert(stream_event_context);
+       BT_ASSERT(stream_event_context);
        stream_event_context_field = bt_ctf_field_structure_get_field_by_name(
                stream_event_context, "common_event_context");
        bt_ctf_field_integer_unsigned_set_value(stream_event_context_field, 42);
@@ -433,7 +434,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
                "packet_size");
        ok(packet_context_field,
                "Packet context contains the default packet_size field.");
-       bt_put(packet_context_field);
+       bt_ctf_object_put_ref(packet_context_field);
        packet_context_field = bt_ctf_field_structure_get_field_by_name(packet_context,
                "custom_packet_context_field");
        ok(bt_ctf_field_integer_unsigned_set_value(packet_context_field, 8) == 0,
@@ -445,32 +446,32 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        ok(bt_ctf_stream_flush(stream) == 0,
                "Flush trace stream with one event");
 
-       bt_put(simple_event_class);
-       bt_put(simple_event);
-       bt_put(uint_12_type);
-       bt_put(int_64_type);
-       bt_put(float_type);
-       bt_put(enum_type);
-       bt_put(enum_type_unsigned);
-       bt_put(returned_type);
-       bt_put(event_context_type);
-       bt_put(integer_field);
-       bt_put(float_field);
-       bt_put(enum_field);
-       bt_put(enum_field_unsigned);
-       bt_put(enum_container_field);
-       bt_put(enum_container_field_unsigned);
-       bt_put(packet_context);
-       bt_put(packet_context_field);
-       bt_put(stream_event_context);
-       bt_put(stream_event_context_field);
-       bt_put(event_context);
-       bt_put(event_context_field);
-       bt_put(event_payload_type);
-       bt_put(ep_integer_field_type);
-       bt_put(ep_enum_field_type);
-       bt_put(ep_enum_field_unsigned_type);
-       bt_put(iter);
+       bt_ctf_object_put_ref(simple_event_class);
+       bt_ctf_object_put_ref(simple_event);
+       bt_ctf_object_put_ref(uint_12_type);
+       bt_ctf_object_put_ref(int_64_type);
+       bt_ctf_object_put_ref(float_type);
+       bt_ctf_object_put_ref(enum_type);
+       bt_ctf_object_put_ref(enum_type_unsigned);
+       bt_ctf_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(event_context_type);
+       bt_ctf_object_put_ref(integer_field);
+       bt_ctf_object_put_ref(float_field);
+       bt_ctf_object_put_ref(enum_field);
+       bt_ctf_object_put_ref(enum_field_unsigned);
+       bt_ctf_object_put_ref(enum_container_field);
+       bt_ctf_object_put_ref(enum_container_field_unsigned);
+       bt_ctf_object_put_ref(packet_context);
+       bt_ctf_object_put_ref(packet_context_field);
+       bt_ctf_object_put_ref(stream_event_context);
+       bt_ctf_object_put_ref(stream_event_context_field);
+       bt_ctf_object_put_ref(event_context);
+       bt_ctf_object_put_ref(event_context_field);
+       bt_ctf_object_put_ref(event_payload_type);
+       bt_ctf_object_put_ref(ep_integer_field_type);
+       bt_ctf_object_put_ref(ep_enum_field_type);
+       bt_ctf_object_put_ref(ep_enum_field_unsigned_type);
+       bt_ctf_object_put_ref(iter);
 }
 
 static
@@ -511,7 +512,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                *inner_structure_field, *complex_structure_field,
                *a_sequence_field, *enum_variant_field, *enum_container_field,
                *variant_field, *an_array_field, *stream_event_ctx_field,
-               *stream_event_ctx_int_field, *ret_field;
+               *stream_event_ctx_int_field;
        uint64_t ret_unsigned_int;
        int64_t ret_signed_int;
        const char *ret_string;
@@ -543,7 +544,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                array_type);
        ok(ret_field_type == int_16_type,
                "bt_ctf_field_type_array_get_element_field_type returns the correct type");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        ok(bt_ctf_field_type_array_get_length(array_type) == ARRAY_TEST_LENGTH,
                "bt_ctf_field_type_array_get_length returns the correct length");
@@ -576,7 +577,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        ret_field_type = bt_ctf_field_type_variant_get_tag_field_type(variant_type);
        ok(ret_field_type == enum_variant_type,
                "bt_ctf_field_type_variant_get_tag_field_type returns a correct tag type");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        ret_string = bt_ctf_field_type_variant_get_tag_name(variant_type);
        ok(ret_string ? !strcmp(ret_string, "variant_selector") : 0,
@@ -585,14 +586,14 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                variant_type, "INT16_TYPE");
        ok(ret_field_type == int_16_type,
                "bt_ctf_field_type_variant_get_field_type_by_name returns a correct field type");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        ok(bt_ctf_field_type_variant_get_field_count(variant_type) == 3,
                "bt_ctf_field_type_variant_get_field_count returns the correct count");
 
        ok(bt_ctf_field_type_variant_get_field_by_index(variant_type, NULL, &ret_field_type, 0) == 0,
                "bt_ctf_field_type_variant_get_field handles a NULL field name correctly");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
        ok(bt_ctf_field_type_variant_get_field_by_index(variant_type, &ret_string, NULL, 0) == 0,
                "bt_ctf_field_type_variant_get_field handles a NULL field type correctly");
        ok(bt_ctf_field_type_variant_get_field_by_index(variant_type, &ret_string, &ret_field_type, 1) == 0,
@@ -601,7 +602,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_field_type_variant_get_field returns a correct field name");
        ok(ret_field_type == int_16_type,
                "bt_ctf_field_type_variant_get_field returns a correct field type");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        ok(!bt_ctf_field_type_structure_add_field(complex_structure_type,
                enum_variant_type, "variant_selector"),
@@ -678,13 +679,13 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        ret_stream_class = bt_ctf_event_class_get_stream_class(event_class);
        ok(ret_stream_class == stream_class,
                "bt_ctf_event_class_get_stream_class returns the correct stream class");
-       bt_put(ret_stream_class);
+       bt_ctf_object_put_ref(ret_stream_class);
 
        ok(bt_ctf_event_class_get_field_by_name(event_class, "truie") == NULL,
                "bt_ctf_event_class_get_field_by_name handles an invalid field name correctly");
        ret_field_type = bt_ctf_event_class_get_field_by_name(event_class,
                "complex_structure");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        event = bt_ctf_event_create(event_class);
        ok(event, "Instanciate a complex event");
@@ -692,7 +693,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        ret_event_class = bt_ctf_event_get_class(event);
        ok(ret_event_class == event_class,
                "bt_ctf_event_get_class returns the correct event class");
-       bt_put(ret_event_class);
+       bt_ctf_object_put_ref(ret_event_class);
 
        uint_35_field = bt_ctf_event_get_payload(event, "uint_35");
        ok(uint_35_field, "Use bt_ctf_event_get_payload to get a field instance ");
@@ -702,7 +703,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_field_integer_unsigned_get_value succeeds after setting a value");
        ok(ret_unsigned_int == 0x0DDF00D,
                "bt_ctf_field_integer_unsigned_get_value returns the correct value");
-       bt_put(uint_35_field);
+       bt_ctf_object_put_ref(uint_35_field);
 
        int_16_field = bt_ctf_event_get_payload(event, "int_16");
        bt_ctf_field_integer_signed_set_value(int_16_field, -12345);
@@ -711,7 +712,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_field_integer_signed_get_value succeeds after setting a value");
        ok(ret_signed_int == -12345,
                "bt_ctf_field_integer_signed_get_value returns the correct value");
-       bt_put(int_16_field);
+       bt_ctf_object_put_ref(int_16_field);
 
        complex_structure_field = bt_ctf_event_get_payload(event,
                "complex_structure");
@@ -719,8 +720,8 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        inner_structure_field = bt_ctf_field_structure_get_field_by_index(
                complex_structure_field, 3);
        ret_field_type = bt_ctf_field_get_type(inner_structure_field);
-       bt_put(inner_structure_field);
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(inner_structure_field);
+       bt_ctf_object_put_ref(ret_field_type);
 
        inner_structure_field = bt_ctf_field_structure_get_field_by_name(
                complex_structure_field, "inner_structure");
@@ -743,7 +744,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        int_16_field = bt_ctf_field_variant_get_field(variant_field,
                enum_variant_field);
        bt_ctf_field_integer_signed_set_value(int_16_field, -200);
-       bt_put(int_16_field);
+       bt_ctf_object_put_ref(int_16_field);
        bt_ctf_field_string_set_value(a_string_field,
                test_string_1);
        ok(!bt_ctf_field_string_append(a_string_field, test_string_2),
@@ -769,31 +770,28 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
 
        ok(bt_ctf_field_sequence_set_length(a_sequence_field,
                uint_35_field) == 0, "Set a sequence field's length");
-       ret_field = bt_ctf_field_sequence_get_length(a_sequence_field);
-       ok(ret_field == uint_35_field,
-               "bt_ctf_field_sequence_get_length returns the correct length field");
 
        for (i = 0; i < SEQUENCE_TEST_LENGTH; i++) {
                int_16_field = bt_ctf_field_sequence_get_field(
                        a_sequence_field, i);
                bt_ctf_field_integer_signed_set_value(int_16_field, 4 - i);
-               bt_put(int_16_field);
+               bt_ctf_object_put_ref(int_16_field);
        }
 
        for (i = 0; i < ARRAY_TEST_LENGTH; i++) {
                int_16_field = bt_ctf_field_array_get_field(
                        an_array_field, i);
                bt_ctf_field_integer_signed_set_value(int_16_field, i);
-               bt_put(int_16_field);
+               bt_ctf_object_put_ref(int_16_field);
        }
 
        stream_event_ctx_field = bt_ctf_event_get_stream_event_context(event);
-       assert(stream_event_ctx_field);
+       BT_ASSERT(stream_event_ctx_field);
        stream_event_ctx_int_field = bt_ctf_field_structure_get_field_by_name(
                stream_event_ctx_field, "common_event_context");
-       BT_PUT(stream_event_ctx_field);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(stream_event_ctx_field);
        bt_ctf_field_integer_unsigned_set_value(stream_event_ctx_int_field, 17);
-       BT_PUT(stream_event_ctx_int_field);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(stream_event_ctx_int_field);
 
        bt_ctf_clock_set_time(clock, ++current_time);
        ok(bt_ctf_stream_append_event(stream, event) == 0,
@@ -811,31 +809,30 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        ok(bt_ctf_stream_flush(stream) == 0,
                "Flush a stream containing a complex event");
 
-       bt_put(uint_35_field);
-       bt_put(a_string_field);
-       bt_put(inner_structure_field);
-       bt_put(complex_structure_field);
-       bt_put(a_sequence_field);
-       bt_put(an_array_field);
-       bt_put(enum_variant_field);
-       bt_put(enum_container_field);
-       bt_put(variant_field);
-       bt_put(ret_field);
-       bt_put(packet_context_field);
-       bt_put(packet_context);
-       bt_put(uint_35_type);
-       bt_put(int_16_type);
-       bt_put(string_type);
-       bt_put(sequence_type);
-       bt_put(array_type);
-       bt_put(inner_structure_type);
-       bt_put(complex_structure_type);
-       bt_put(uint_3_type);
-       bt_put(enum_variant_type);
-       bt_put(variant_type);
-       bt_put(ret_field_type);
-       bt_put(event_class);
-       bt_put(event);
+       bt_ctf_object_put_ref(uint_35_field);
+       bt_ctf_object_put_ref(a_string_field);
+       bt_ctf_object_put_ref(inner_structure_field);
+       bt_ctf_object_put_ref(complex_structure_field);
+       bt_ctf_object_put_ref(a_sequence_field);
+       bt_ctf_object_put_ref(an_array_field);
+       bt_ctf_object_put_ref(enum_variant_field);
+       bt_ctf_object_put_ref(enum_container_field);
+       bt_ctf_object_put_ref(variant_field);
+       bt_ctf_object_put_ref(packet_context_field);
+       bt_ctf_object_put_ref(packet_context);
+       bt_ctf_object_put_ref(uint_35_type);
+       bt_ctf_object_put_ref(int_16_type);
+       bt_ctf_object_put_ref(string_type);
+       bt_ctf_object_put_ref(sequence_type);
+       bt_ctf_object_put_ref(array_type);
+       bt_ctf_object_put_ref(inner_structure_type);
+       bt_ctf_object_put_ref(complex_structure_type);
+       bt_ctf_object_put_ref(uint_3_type);
+       bt_ctf_object_put_ref(enum_variant_type);
+       bt_ctf_object_put_ref(variant_type);
+       bt_ctf_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(event_class);
+       bt_ctf_object_put_ref(event);
 }
 
 static
@@ -921,7 +918,7 @@ void type_field_tests()
                "bt_ctf_field_type_integer_get_encoding returns a correct value");
 
        int_16_type = bt_ctf_field_type_integer_create(16);
-       assert(int_16_type);
+       BT_ASSERT(int_16_type);
        ok(!bt_ctf_field_type_integer_set_signed(int_16_type, 1),
                "Set signedness of 16 bit integer to true");
        ok(bt_ctf_field_type_integer_get_signed(int_16_type) == 1,
@@ -942,7 +939,7 @@ void type_field_tests()
                sequence_type);
        ok(returned_type == int_16_type,
                "bt_ctf_field_type_sequence_get_element_field_type returns the correct type");
-       bt_put(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        string_type = bt_ctf_field_type_string_create();
        ok(string_type, "Create a string type");
@@ -978,7 +975,7 @@ void type_field_tests()
        ok(bt_ctf_field_type_structure_get_field(structure_seq_type,
                NULL, &returned_type, 1) == 0,
                "bt_ctf_field_type_structure_get_field handles a NULL name correctly");
-       bt_put(returned_type);
+       bt_ctf_object_put_ref(returned_type);
        ok(bt_ctf_field_type_structure_get_field(structure_seq_type,
                &ret_string, NULL, 1) == 0,
                "bt_ctf_field_type_structure_get_field handles a NULL return type correctly");
@@ -989,13 +986,13 @@ void type_field_tests()
                "bt_ctf_field_type_structure_get_field returns a correct field name");
        ok(returned_type == sequence_type,
                "bt_ctf_field_type_structure_get_field returns a correct field type");
-       bt_put(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        returned_type = bt_ctf_field_type_structure_get_field_type_by_name(
                structure_seq_type, "a_sequence");
        ok(returned_type == sequence_type,
                "bt_ctf_field_type_structure_get_field_type_by_name returns the correct field type");
-       bt_put(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        composite_structure_type = bt_ctf_field_type_structure_create();
        ok(bt_ctf_field_type_structure_add_field(composite_structure_type,
@@ -1009,7 +1006,7 @@ void type_field_tests()
                structure_seq_type, "a_sequence");
        ok(returned_type == sequence_type,
                "bt_ctf_field_type_structure_get_field_type_by_name returns a correct type");
-       bt_put(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        int_16 = bt_ctf_field_create(int_16_type);
        ok(int_16, "Instanciate a signed 16-bit integer");
@@ -1048,18 +1045,18 @@ void type_field_tests()
        ok(enumeration_type,
                "Create an enumeration type with an unsigned 12-bit integer as container");
 
-       bt_put(string);
-       bt_put(uint_12);
-       bt_put(int_16);
-       bt_put(composite_structure_type);
-       bt_put(structure_seq_type);
-       bt_put(string_type);
-       bt_put(sequence_type);
-       bt_put(uint_8_type);
-       bt_put(int_16_type);
-       bt_put(uint_12_type);
-       bt_put(enumeration_type);
-       bt_put(returned_type);
+       bt_ctf_object_put_ref(string);
+       bt_ctf_object_put_ref(uint_12);
+       bt_ctf_object_put_ref(int_16);
+       bt_ctf_object_put_ref(composite_structure_type);
+       bt_ctf_object_put_ref(structure_seq_type);
+       bt_ctf_object_put_ref(string_type);
+       bt_ctf_object_put_ref(sequence_type);
+       bt_ctf_object_put_ref(uint_8_type);
+       bt_ctf_object_put_ref(int_16_type);
+       bt_ctf_object_put_ref(uint_12_type);
+       bt_ctf_object_put_ref(enumeration_type);
+       bt_ctf_object_put_ref(returned_type);
 }
 
 static
@@ -1106,20 +1103,20 @@ void packet_resize_test(struct bt_ctf_stream_class *stream_class,
         * appropriate fields.
         */
        ep_type = bt_ctf_event_class_get_payload_field_type(event_class);
-       assert(ep_type);
+       BT_ASSERT(ep_type);
        ep_field_1_type = bt_ctf_field_type_structure_get_field_type_by_name(
                ep_type, "field_1");
-       assert(ep_field_1_type);
+       BT_ASSERT(ep_field_1_type);
        ep_a_string_type = bt_ctf_field_type_structure_get_field_type_by_name(
                ep_type, "a_string");
-       assert(ep_a_string_type);
+       BT_ASSERT(ep_a_string_type);
 
        event = bt_ctf_event_create(event_class);
        ret_field = bt_ctf_event_get_payload(event, 0);
        ret_field_type = bt_ctf_field_get_type(ret_field);
-       bt_put(ret_field_type);
-       bt_put(ret_field);
-       bt_put(event);
+       bt_ctf_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field);
+       bt_ctf_object_put_ref(event);
 
        for (i = 0; i < packet_resize_test_length; i++) {
                event = bt_ctf_event_create(event_class);
@@ -1132,24 +1129,24 @@ void packet_resize_test(struct bt_ctf_stream_class *stream_class,
                ret |= bt_ctf_field_integer_unsigned_set_value(integer, i);
                ret |= bt_ctf_event_set_payload(event, "field_1",
                        integer);
-               bt_put(integer);
+               bt_ctf_object_put_ref(integer);
                ret |= bt_ctf_field_string_set_value(string, "This is a test");
                ret |= bt_ctf_event_set_payload(event, "a_string",
                        string);
-               bt_put(string);
+               bt_ctf_object_put_ref(string);
 
                /* Populate stream event context */
                stream_event_context =
                        bt_ctf_event_get_stream_event_context(event);
                integer = bt_ctf_field_structure_get_field_by_name(stream_event_context,
                        "common_event_context");
-               BT_PUT(stream_event_context);
+               BT_CTF_OBJECT_PUT_REF_AND_RESET(stream_event_context);
                ret |= bt_ctf_field_integer_unsigned_set_value(integer,
                        i % 42);
-               bt_put(integer);
+               bt_ctf_object_put_ref(integer);
 
                ret |= bt_ctf_stream_append_event(stream, event);
-               bt_put(event);
+               bt_ctf_object_put_ref(event);
 
                if (ret) {
                        break;
@@ -1182,15 +1179,15 @@ end:
        ret = bt_ctf_stream_get_discarded_events_count(stream, &ret_uint64);
        ok(ret == 0 && ret_uint64 == 1000,
                "bt_ctf_stream_get_discarded_events_count returns a correct number of discarded events after a flush");
-       bt_put(integer_type);
-       bt_put(string_type);
-       bt_put(packet_context);
-       bt_put(packet_context_field);
-       bt_put(stream_event_context);
-       bt_put(event_class);
-       bt_put(ep_field_1_type);
-       bt_put(ep_a_string_type);
-       bt_put(ep_type);
+       bt_ctf_object_put_ref(integer_type);
+       bt_ctf_object_put_ref(string_type);
+       bt_ctf_object_put_ref(packet_context);
+       bt_ctf_object_put_ref(packet_context_field);
+       bt_ctf_object_put_ref(stream_event_context);
+       bt_ctf_object_put_ref(event_class);
+       bt_ctf_object_put_ref(ep_field_1_type);
+       bt_ctf_object_put_ref(ep_a_string_type);
+       bt_ctf_object_put_ref(ep_type);
 }
 
 static
@@ -1216,9 +1213,9 @@ void test_empty_stream(struct bt_ctf_writer *writer)
        }
 
        ret = bt_ctf_stream_class_set_packet_context_type(stream_class, NULL);
-       assert(ret == 0);
+       BT_ASSERT(ret == 0);
        ret = bt_ctf_stream_class_set_event_header_type(stream_class, NULL);
-       assert(ret == 0);
+       BT_ASSERT(ret == 0);
 
        ok(bt_ctf_stream_class_get_trace(stream_class) == NULL,
                "bt_ctf_stream_class_get_trace returns NULL when stream class is orphaned");
@@ -1236,10 +1233,10 @@ void test_empty_stream(struct bt_ctf_writer *writer)
 end:
        ok(ret == 0,
                "Created a stream class with default attributes and an empty stream");
-       bt_put(trace);
-       bt_put(ret_trace);
-       bt_put(stream);
-       bt_put(stream_class);
+       bt_ctf_object_put_ref(trace);
+       bt_ctf_object_put_ref(ret_trace);
+       bt_ctf_object_put_ref(stream);
+       bt_ctf_object_put_ref(stream_class);
 }
 
 static
@@ -1351,7 +1348,7 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer,
                fail("Failed to set custom_trace_packet_header_field value");
                goto end;
        }
-       bt_put(integer);
+       bt_ctf_object_put_ref(integer);
 
        event = bt_ctf_event_create(event_class);
        if (!event) {
@@ -1390,7 +1387,7 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer,
                fail("Failed to set sequence length");
                goto end;
        }
-       bt_put(integer);
+       bt_ctf_object_put_ref(integer);
 
        for (i = 0; i < 2; i++) {
                integer = bt_ctf_field_sequence_get_field(sequence, i);
@@ -1405,7 +1402,7 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer,
                        goto end;
                }
 
-               bt_put(integer);
+               bt_ctf_object_put_ref(integer);
                integer = NULL;
        }
 
@@ -1420,17 +1417,17 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer,
                fail("Failed to flush custom_event_header stream");
        }
 end:
-       bt_put(stream);
-       bt_put(stream_class);
-       bt_put(event_class);
-       bt_put(event);
-       bt_put(integer);
-       bt_put(sequence);
-       bt_put(event_header);
-       bt_put(packet_header);
-       bt_put(sequence_type);
-       bt_put(integer_type);
-       bt_put(event_header_type);
+       bt_ctf_object_put_ref(stream);
+       bt_ctf_object_put_ref(stream_class);
+       bt_ctf_object_put_ref(event_class);
+       bt_ctf_object_put_ref(event);
+       bt_ctf_object_put_ref(integer);
+       bt_ctf_object_put_ref(sequence);
+       bt_ctf_object_put_ref(event_header);
+       bt_ctf_object_put_ref(packet_header);
+       bt_ctf_object_put_ref(sequence_type);
+       bt_ctf_object_put_ref(integer_type);
+       bt_ctf_object_put_ref(event_header_type);
 }
 
 static
@@ -1527,33 +1524,35 @@ void test_instanciate_event_before_stream(struct bt_ctf_writer *writer,
 end:
        ok(ret == 0,
                "Create an event before instanciating its associated stream");
-       bt_put(stream);
-       bt_put(ret_stream);
-       bt_put(stream_class);
-       bt_put(event_class);
-       bt_put(event);
-       bt_put(integer_type);
-       bt_put(integer);
-       bt_put(payload_field);
+       bt_ctf_object_put_ref(stream);
+       bt_ctf_object_put_ref(ret_stream);
+       bt_ctf_object_put_ref(stream_class);
+       bt_ctf_object_put_ref(event_class);
+       bt_ctf_object_put_ref(event);
+       bt_ctf_object_put_ref(integer_type);
+       bt_ctf_object_put_ref(integer);
+       bt_ctf_object_put_ref(payload_field);
 }
 
 static
 void append_existing_event_class(struct bt_ctf_stream_class *stream_class)
 {
+       int ret;
        struct bt_ctf_event_class *event_class;
 
        event_class = bt_ctf_event_class_create("Simple Event");
-       assert(event_class);
+       BT_ASSERT(event_class);
        ok(bt_ctf_stream_class_add_event_class(stream_class, event_class) == 0,
                "two event classes with the same name may cohabit within the same stream class");
-       bt_put(event_class);
+       bt_ctf_object_put_ref(event_class);
 
        event_class = bt_ctf_event_class_create("different name, ok");
-       assert(event_class);
-       assert(!bt_ctf_event_class_set_id(event_class, 13));
+       BT_ASSERT(event_class);
+       ret = bt_ctf_event_class_set_id(event_class, 13);
+       BT_ASSERT(ret == 0);
        ok(bt_ctf_stream_class_add_event_class(stream_class, event_class),
                "two event classes with the same ID cannot cohabit within the same stream class");
-       bt_put(event_class);
+       bt_ctf_object_put_ref(event_class);
 }
 
 static
@@ -1563,17 +1562,17 @@ void test_clock_utils(void)
        struct bt_ctf_clock *clock = NULL;
 
        clock = bt_ctf_clock_create("water");
-       assert(clock);
+       BT_ASSERT(clock);
        ret = bt_ctf_clock_set_offset_s(clock, 1234);
-       assert(!ret);
+       BT_ASSERT(!ret);
        ret = bt_ctf_clock_set_offset(clock, 1000);
-       assert(!ret);
+       BT_ASSERT(!ret);
        ret = bt_ctf_clock_set_frequency(clock, 1000000000);
-       assert(!ret);
+       BT_ASSERT(!ret);
        ret = bt_ctf_clock_set_frequency(clock, 1534);
-       assert(!ret);
+       BT_ASSERT(!ret);
 
-       BT_PUT(clock);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(clock);
 }
 
 int main(int argc, char **argv)
@@ -1597,7 +1596,6 @@ int main(int argc, char **argv)
        struct bt_utsname name = {"GNU/Linux", "testhost", "4.4.0-87-generic",
                "#110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017", "x86_64"};
        struct bt_ctf_clock *clock, *ret_clock;
-       struct bt_ctf_clock_class *ret_clock_class;
        struct bt_ctf_stream_class *stream_class, *ret_stream_class;
        struct bt_ctf_stream *stream1;
        struct bt_ctf_stream *stream;
@@ -1615,8 +1613,6 @@ int main(int argc, char **argv)
        struct bt_ctf_field *packet_header, *packet_header_field;
        struct bt_ctf_trace *trace;
        int ret;
-       int64_t ret_int64_t;
-       struct bt_value *obj;
 
        if (argc < 2) {
                printf("Usage: tests-ctf-writer path_to_babeltrace\n");
@@ -1669,26 +1665,6 @@ int main(int argc, char **argv)
                NULL),
                "bt_ctf_writer_add_environment_field error with NULL field value");
 
-       /* Test bt_ctf_trace_set_environment_field with an integer object */
-       obj = bt_value_integer_create_init(23);
-       assert(obj);
-       ok(bt_ctf_trace_set_environment_field(NULL, "test_env_int_obj", obj),
-               "bt_ctf_trace_set_environment_field handles a NULL trace correctly");
-       ok(bt_ctf_trace_set_environment_field(trace, NULL, obj),
-               "bt_ctf_trace_set_environment_field handles a NULL name correctly");
-       ok(bt_ctf_trace_set_environment_field(trace, "test_env_int_obj", NULL),
-               "bt_ctf_trace_set_environment_field handles a NULL value correctly");
-       ok(!bt_ctf_trace_set_environment_field(trace, "test_env_int_obj", obj),
-               "bt_ctf_trace_set_environment_field succeeds in adding an integer object");
-       BT_PUT(obj);
-
-       /* Test bt_ctf_trace_set_environment_field with a string object */
-       obj = bt_value_string_create_init("the value");
-       assert(obj);
-       ok(!bt_ctf_trace_set_environment_field(trace, "test_env_str_obj", obj),
-               "bt_ctf_trace_set_environment_field succeeds in adding a string object");
-       BT_PUT(obj);
-
        /* Test bt_ctf_trace_set_environment_field_integer */
        ok(bt_ctf_trace_set_environment_field_integer(NULL, "test_env_int",
                -194875),
@@ -1712,60 +1688,10 @@ int main(int argc, char **argv)
                "oh yeah"),
                "bt_ctf_trace_set_environment_field_string succeeds");
 
-       /* Test bt_ctf_trace_get_environment_field_count */
-       ok(bt_ctf_trace_get_environment_field_count(trace) == 5,
-               "bt_ctf_trace_get_environment_field_count returns a correct number of environment fields");
-
-       /* Test bt_ctf_trace_get_environment_field_name */
-       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 0);
-       ok(ret_string && !strcmp(ret_string, "host"),
-               "bt_ctf_trace_get_environment_field_name returns a correct field name");
-       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 1);
-       ok(ret_string && !strcmp(ret_string, "test_env_int_obj"),
-               "bt_ctf_trace_get_environment_field_name returns a correct field name");
-       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 2);
-       ok(ret_string && !strcmp(ret_string, "test_env_str_obj"),
-               "bt_ctf_trace_get_environment_field_name returns a correct field name");
-       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 3);
-       ok(ret_string && !strcmp(ret_string, "test_env_int"),
-               "bt_ctf_trace_get_environment_field_name returns a correct field name");
-       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 4);
-       ok(ret_string && !strcmp(ret_string, "test_env_str"),
-               "bt_ctf_trace_get_environment_field_name returns a correct field name");
-
-       /* Test bt_ctf_trace_get_environment_field_value */
-       obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 1);
-       ret = bt_value_integer_get(obj, &ret_int64_t);
-       ok(!ret && ret_int64_t == 23,
-               "bt_ctf_trace_get_environment_field_value succeeds in getting an integer value");
-       BT_PUT(obj);
-       obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 2);
-       ret = bt_value_string_get(obj, &ret_string);
-       ok(!ret && ret_string && !strcmp(ret_string, "the value"),
-               "bt_ctf_trace_get_environment_field_value succeeds in getting a string value");
-       BT_PUT(obj);
-
-       /* Test bt_ctf_trace_get_environment_field_value_by_name */
-       ok(!bt_ctf_trace_get_environment_field_value_by_name(trace, "oh oh"),
-               "bt_ctf_trace_get_environment_field_value_by_name returns NULL or an unknown field name");
-       obj = bt_ctf_trace_get_environment_field_value_by_name(trace,
-               "test_env_str");
-       ret = bt_value_string_get(obj, &ret_string);
-       ok(!ret && ret_string && !strcmp(ret_string, "oh yeah"),
-               "bt_ctf_trace_get_environment_field_value_by_name succeeds in getting an existing field");
-       BT_PUT(obj);
-
        /* Test environment field replacement */
        ok(!bt_ctf_trace_set_environment_field_integer(trace, "test_env_int",
                654321),
                "bt_ctf_trace_set_environment_field_integer succeeds with an existing name");
-       ok(bt_ctf_trace_get_environment_field_count(trace) == 5,
-               "bt_ctf_trace_set_environment_field_integer with an existing key does not increase the environment size");
-       obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 3);
-       ret = bt_value_integer_get(obj, &ret_int64_t);
-       ok(!ret && ret_int64_t == 654321,
-               "bt_ctf_trace_get_environment_field_value successfully replaces an existing field");
-       BT_PUT(obj);
 
        ok(bt_ctf_writer_add_environment_field(writer, "sysname", name.sysname)
                == 0, "Add sysname (%s) environment field to writer instance",
@@ -1883,7 +1809,7 @@ int main(int argc, char **argv)
        ret_clock = bt_ctf_stream_class_get_clock(stream_class);
        ok(ret_clock == clock,
                "bt_ctf_stream_class_get_clock returns a correct clock");
-       bt_put(ret_clock);
+       bt_ctf_object_put_ref(ret_clock);
 
        /* Test the event fields and event types APIs */
        type_field_tests();
@@ -1912,7 +1838,7 @@ int main(int argc, char **argv)
        ok(bt_ctf_field_type_get_type_id(
                event_header_field_type) == BT_CTF_FIELD_TYPE_ID_INTEGER,
                "Default event header \"id\" field is an integer");
-       bt_put(event_header_field_type);
+       bt_ctf_object_put_ref(event_header_field_type);
        event_header_field_type =
                bt_ctf_field_type_structure_get_field_type_by_name(
                ret_field_type, "timestamp");
@@ -1921,8 +1847,8 @@ int main(int argc, char **argv)
        ok(bt_ctf_field_type_get_type_id(
                event_header_field_type) == BT_CTF_FIELD_TYPE_ID_INTEGER,
                "Default event header \"timestamp\" field is an integer");
-       bt_put(event_header_field_type);
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(event_header_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        /* Add a custom trace packet header field */
        packet_header_type = bt_ctf_trace_get_packet_header_field_type(trace);
@@ -1933,15 +1859,15 @@ int main(int argc, char **argv)
        ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
                packet_header_type, "magic");
        ok(ret_field_type, "Default packet header type contains a \"magic\" field");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
        ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
                packet_header_type, "uuid");
        ok(ret_field_type, "Default packet header type contains a \"uuid\" field");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
        ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
                packet_header_type, "stream_id");
        ok(ret_field_type, "Default packet header type contains a \"stream_id\" field");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        packet_header_field_type = bt_ctf_field_type_integer_create(22);
        ok(!bt_ctf_field_type_structure_add_field(packet_header_type,
@@ -1996,12 +1922,12 @@ int main(int argc, char **argv)
                stream_class);
        ok(ret_field_type == stream_event_context_type,
                "bt_ctf_stream_class_get_event_context_type returns the correct field type.");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
 
        /* Instantiate a stream and append events */
        ret = bt_ctf_writer_add_clock(writer, clock);
-       assert(ret == 0);
+       BT_ASSERT(ret == 0);
 
        ok(bt_ctf_trace_get_stream_count(trace) == 0,
                "bt_ctf_trace_get_stream_count() succeeds and returns the correct value (0)");
@@ -2012,27 +1938,13 @@ int main(int argc, char **argv)
        stream = bt_ctf_trace_get_stream_by_index(trace, 0);
        ok(stream == stream1,
                "bt_ctf_trace_get_stream_by_index() succeeds and returns the correct value");
-       BT_PUT(stream);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(stream);
 
        /*
         * Creating a stream through a writer adds the given stream
         * class to the writer's trace, thus registering the stream
         * class's clock to the trace.
         */
-       ok(bt_ctf_trace_get_clock_class_count(trace) == 1,
-               "bt_ctf_trace_get_clock_class_count returns the correct number of clocks");
-       ret_clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
-       ok(strcmp(bt_ctf_clock_class_get_name(ret_clock_class),
-               bt_ctf_clock_get_name(clock)) == 0,
-               "bt_ctf_trace_get_clock_class returns the right clock instance");
-       bt_put(ret_clock_class);
-       ret_clock_class = bt_ctf_trace_get_clock_class_by_name(trace, clock_name);
-       ok(strcmp(bt_ctf_clock_class_get_name(ret_clock_class),
-               bt_ctf_clock_get_name(clock)) == 0,
-               "bt_ctf_trace_get_clock_class returns the right clock instance");
-       bt_put(ret_clock_class);
-       ok(!bt_ctf_trace_get_clock_class_by_name(trace, "random"),
-               "bt_ctf_trace_get_clock_by_name fails when the requested clock doesn't exist");
 
        ret_stream_class = bt_ctf_stream_get_class(stream1);
        ok(ret_stream_class,
@@ -2045,17 +1957,17 @@ int main(int argc, char **argv)
         * event context types were copied for the resolving
         * process
         */
-       BT_PUT(packet_header_type);
-       BT_PUT(packet_context_type);
-       BT_PUT(stream_event_context_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(packet_header_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(packet_context_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(stream_event_context_type);
        packet_header_type = bt_ctf_trace_get_packet_header_field_type(trace);
-       assert(packet_header_type);
+       BT_ASSERT(packet_header_type);
        packet_context_type =
                bt_ctf_stream_class_get_packet_context_type(stream_class);
-       assert(packet_context_type);
+       BT_ASSERT(packet_context_type);
        stream_event_context_type =
                bt_ctf_stream_class_get_event_context_type(stream_class);
-       assert(stream_event_context_type);
+       BT_ASSERT(stream_event_context_type);
 
        /*
         * Try to modify the packet context type after a stream has been
@@ -2097,7 +2009,7 @@ int main(int argc, char **argv)
        ret_field_type = bt_ctf_field_get_type(packet_header);
        ok(ret_field_type == packet_header_type,
                "Stream returns a packet header of the appropriate type");
-       bt_put(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
        packet_header_field = bt_ctf_field_structure_get_field_by_name(packet_header,
                "custom_trace_packet_header_field");
        ok(packet_header_field,
@@ -2138,22 +2050,22 @@ int main(int argc, char **argv)
 
        bt_ctf_writer_flush_metadata(writer);
 
-       bt_put(clock);
-       bt_put(ret_stream_class);
-       bt_put(writer);
-       bt_put(stream1);
-       bt_put(packet_context_type);
-       bt_put(packet_context_field_type);
-       bt_put(integer_type);
-       bt_put(stream_event_context_type);
-       bt_put(ret_field_type);
-       bt_put(packet_header_type);
-       bt_put(packet_header_field_type);
-       bt_put(packet_header);
-       bt_put(packet_header_field);
-       bt_put(trace);
+       bt_ctf_object_put_ref(clock);
+       bt_ctf_object_put_ref(ret_stream_class);
+       bt_ctf_object_put_ref(writer);
+       bt_ctf_object_put_ref(stream1);
+       bt_ctf_object_put_ref(packet_context_type);
+       bt_ctf_object_put_ref(packet_context_field_type);
+       bt_ctf_object_put_ref(integer_type);
+       bt_ctf_object_put_ref(stream_event_context_type);
+       bt_ctf_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(packet_header_type);
+       bt_ctf_object_put_ref(packet_header_field_type);
+       bt_ctf_object_put_ref(packet_header);
+       bt_ctf_object_put_ref(packet_header_field);
+       bt_ctf_object_put_ref(trace);
        free(metadata_string);
-       bt_put(stream_class);
+       bt_ctf_object_put_ref(stream_class);
 
        validate_trace(argv[1], trace_path);
 
This page took 0.041492 seconds and 4 git commands to generate.