discarded-items.c: add clock class's existence precondition assertion
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 18 Feb 2019 23:09:59 +0000 (18:09 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
lib/graph/message/discarded-items.c

index 78b30e45b9f82fc2dfe22aed113fe772b7ac0b2b..a4bc9e3b2f8b527302238f794e3b50ef9ea9f92f 100644 (file)
@@ -74,6 +74,15 @@ struct bt_message *create_discarded_items_message(
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        stream_class = bt_stream_borrow_class(stream);
        BT_ASSERT(stream_class);
+       BT_ASSERT_PRE((with_cs && stream_class->default_clock_class) ||
+               (!with_cs && !stream_class->default_clock_class),
+               "Creating a message with a default clock snapshot, but without "
+               "a default clock class, or without a default clock snapshot, "
+               "but with a default clock class: ",
+               "type=%s, %![stream-]+s, %![sc-]+S, with-cs=%d, "
+               "cs-begin-val=%" PRIu64 ", cs-end-val=%" PRIu64,
+               bt_message_type_string(type), stream, stream_class,
+               with_cs, beginning_raw_value, end_raw_value);
        BT_LIB_LOGD("Creating discarded items message object: "
                "type=%s, %![stream-]+s, %![sc-]+S, with-cs=%d, "
                "cs-begin-val=%" PRIu64 ", cs-end-val=%" PRIu64,
@@ -91,6 +100,7 @@ struct bt_message *create_discarded_items_message(
        bt_object_get_no_null_check(message->stream);
 
        if (with_cs) {
+               BT_ASSERT(stream_class->default_clock_class);
                message->default_begin_cs = bt_clock_snapshot_create(
                        stream_class->default_clock_class);
                if (!message->default_begin_cs) {
This page took 0.026169 seconds and 4 git commands to generate.