lib: add pre condition asserts to check current thread has no error
[babeltrace.git] / src / lib / trace-ir / stream.c
index c567768fe03f47669ba15781e251f5cf9752cc14..c35b9da99ea2851a71de06cf3e328e0e014fc559 100644 (file)
@@ -34,6 +34,7 @@
 #include "common/assert.h"
 #include "lib/property.h"
 #include <inttypes.h>
+#include <stdbool.h>
 #include <unistd.h>
 
 #include "packet.h"
@@ -145,7 +146,7 @@ struct bt_stream *create_stream_with_id(struct bt_stream_class *stream_class,
        }
 
        stream->class = stream_class;
-       bt_object_get_no_null_check(stream_class);
+       bt_object_get_ref_no_null_check(stream_class);
 
        /* bt_trace_add_stream() sets the parent trace, and freezes the trace */
        bt_trace_add_stream(trace, stream);
@@ -166,6 +167,7 @@ struct bt_stream *bt_stream_create(struct bt_stream_class *stream_class,
 {
        uint64_t id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE(stream_class->assigns_automatic_stream_id,
@@ -178,6 +180,7 @@ struct bt_stream *bt_stream_create(struct bt_stream_class *stream_class,
 struct bt_stream *bt_stream_create_with_id(struct bt_stream_class *stream_class,
                struct bt_trace *trace, uint64_t id)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE(!stream_class->assigns_automatic_stream_id,
@@ -219,6 +222,7 @@ const char *bt_stream_get_name(const struct bt_stream *stream)
 enum bt_stream_set_name_status bt_stream_set_name(struct bt_stream *stream,
                const char *name)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_DEV_STREAM_HOT(stream);
@@ -265,9 +269,9 @@ void bt_stream_set_user_attributes(struct bt_stream *stream,
        BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP,
                "User attributes object is not a map value object.");
        BT_ASSERT_PRE_DEV_STREAM_HOT(stream);
-       bt_object_put_no_null_check(stream->user_attributes);
+       bt_object_put_ref_no_null_check(stream->user_attributes);
        stream->user_attributes = (void *) user_attributes;
-       bt_object_get_no_null_check(stream->user_attributes);
+       bt_object_get_ref_no_null_check(stream->user_attributes);
 }
 
 void bt_stream_get_ref(const struct bt_stream *stream)
This page took 0.023821 seconds and 4 git commands to generate.