X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=lib%2Fgraph%2Fmessage%2Fpacket.c;fp=lib%2Fgraph%2Fmessage%2Fpacket.c;h=9ed9a0c47f2eb3054553feb4402dab82f0d6d504;hp=abaa7c7f6e37a744a94ff1bdc14e2f66089a4253;hb=8cc5f12befb744624f1683cda7d979d7c6cff4a5;hpb=1d4ac4b6541dcbbe1f676e198ab868fe5254ba49 diff --git a/lib/graph/message/packet.c b/lib/graph/message/packet.c index abaa7c7f..9ed9a0c4 100644 --- a/lib/graph/message/packet.c +++ b/lib/graph/message/packet.c @@ -87,7 +87,7 @@ struct bt_message *create_packet_message( struct bt_message_packet *message = NULL; struct bt_stream *stream; struct bt_stream_class *stream_class; - bool packet_has_default_clock_snapshot; + bool need_cs; BT_ASSERT(msg_iter); BT_ASSERT_PRE_NON_NULL(packet, "Packet"); @@ -97,21 +97,26 @@ struct bt_message *create_packet_message( BT_ASSERT(stream_class); if (pool == &msg_iter->graph->packet_begin_msg_pool) { - packet_has_default_clock_snapshot = - stream_class->packets_have_beginning_default_clock_snapshot; + need_cs = stream_class->packets_have_beginning_default_clock_snapshot; } else { - packet_has_default_clock_snapshot = - stream_class->packets_have_end_default_clock_snapshot; + need_cs = stream_class->packets_have_end_default_clock_snapshot; } /* * `packet_has_default_clock_snapshot` implies that the stream * class has a default clock class (precondition). */ - BT_ASSERT_PRE((with_cs && packet_has_default_clock_snapshot) || - (!with_cs && !packet_has_default_clock_snapshot), + BT_ASSERT_PRE(need_cs ? with_cs : true, "Unexpected stream class configuration when creating " - "a packet beginning or end message: ", + "a packet beginning or end message: " + "a default clock snapshot is needed, but none was provided: " + "%![stream-]+s, %![sc-]+S, with-cs=%d, " + "cs-val=%" PRIu64, + stream, stream_class, with_cs, raw_value); + BT_ASSERT_PRE(!need_cs ? !with_cs : true, + "Unexpected stream class configuration when creating " + "a packet beginning or end message: " + "no default clock snapshot is needed, but one was provided: " "%![stream-]+s, %![sc-]+S, with-cs=%d, " "cs-val=%" PRIu64, stream, stream_class, with_cs, raw_value);