X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=lib%2Fgraph%2Fmessage%2Fdiscarded-items.c;fp=lib%2Fgraph%2Fmessage%2Fdiscarded-items.c;h=36bdc3689d330f4da709d496fcb24bd1e0462abc;hp=5f7108f829db3633b14b5a1a54ac2dd8422916c8;hb=8cc5f12befb744624f1683cda7d979d7c6cff4a5;hpb=1d4ac4b6541dcbbe1f676e198ab868fe5254ba49 diff --git a/lib/graph/message/discarded-items.c b/lib/graph/message/discarded-items.c index 5f7108f8..36bdc368 100644 --- a/lib/graph/message/discarded-items.c +++ b/lib/graph/message/discarded-items.c @@ -70,7 +70,7 @@ struct bt_message *create_discarded_items_message( struct bt_message_discarded_items *message; struct bt_stream_class *stream_class; bool has_support; - bool has_default_clock_snapshots; + bool need_cs; BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator"); BT_ASSERT_PRE_NON_NULL(stream, "Stream"); @@ -79,22 +79,28 @@ struct bt_message *create_discarded_items_message( if (type == BT_MESSAGE_TYPE_DISCARDED_EVENTS) { has_support = stream_class->supports_discarded_events; - has_default_clock_snapshots = - stream_class->discarded_events_have_default_clock_snapshots; + need_cs = stream_class->discarded_events_have_default_clock_snapshots; } else { has_support = stream_class->supports_discarded_packets; - has_default_clock_snapshots = - stream_class->discarded_packets_have_default_clock_snapshots; + need_cs = stream_class->discarded_packets_have_default_clock_snapshots; } BT_ASSERT_PRE(has_support, "Stream class does not support discarded events or packets: " "type=%s, %![stream-]+s, %![sc-]+S", bt_message_type_string(type), stream, stream_class); - BT_ASSERT_PRE((with_cs && has_default_clock_snapshots) || - (!with_cs && !has_default_clock_snapshots), + BT_ASSERT_PRE(need_cs ? with_cs : true, "Unexpected stream class configuration when creating " - "a discarded events or packets message: " + "a discarded events or discarded packets message: " + "default clock snapshots are needed, but none was provided: " + "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_ASSERT_PRE(!need_cs ? !with_cs : true, + "Unexpected stream class configuration when creating " + "a discarded events or discarded packets message: " + "no default clock snapshots are needed, but two were provided: " "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,