X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fgraph%2Fiterator.c;h=6a969826cc4da08a253d023360e01ead5851a99c;hb=2cf86e2068e546ad060b45612d1cdf28178a7ace;hp=01c21128e84c69ea3cb7ac3d598e55d96aa0093f;hpb=d47c10dce32fd4bb282bd7e93dc2b74a67b6128b;p=babeltrace.git diff --git a/lib/graph/iterator.c b/lib/graph/iterator.c index 01c21128..6a969826 100644 --- a/lib/graph/iterator.c +++ b/lib/graph/iterator.c @@ -83,6 +83,7 @@ (_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, \ "Message iterator is in the wrong state: %!+i", _iter) +BT_ASSERT_PRE_FUNC static inline void _set_self_comp_port_input_msg_iterator_state( struct bt_self_component_port_input_message_iterator *iterator, @@ -97,7 +98,7 @@ void _set_self_comp_port_input_msg_iterator_state( #ifdef BT_DEV_MODE # define set_self_comp_port_input_msg_iterator_state _set_self_comp_port_input_msg_iterator_state #else -# define set_self_comp_port_input_msg_iterator_state(_a, _b) +# define set_self_comp_port_input_msg_iterator_state(_a, _b) ((void) _a); ((void) _b); #endif static @@ -526,39 +527,6 @@ void bt_self_message_iterator_set_data( "%!+i, user-data-addr=%p", iterator, data); } -BT_ASSERT_PRE_FUNC -static inline -void bt_message_borrow_packet_stream(const struct bt_message *msg, - const struct bt_stream **stream, - const struct bt_packet **packet) -{ - BT_ASSERT(msg); - - switch (msg->type) { - case BT_MESSAGE_TYPE_EVENT: - *packet = bt_event_borrow_packet_const( - bt_message_event_borrow_event_const(msg)); - *stream = bt_packet_borrow_stream_const(*packet); - break; - case BT_MESSAGE_TYPE_STREAM_BEGINNING: - *stream = bt_message_stream_beginning_borrow_stream_const(msg); - break; - case BT_MESSAGE_TYPE_STREAM_END: - *stream = bt_message_stream_end_borrow_stream_const(msg); - break; - case BT_MESSAGE_TYPE_PACKET_BEGINNING: - *packet = bt_message_packet_beginning_borrow_packet_const(msg); - *stream = bt_packet_borrow_stream_const(*packet); - break; - case BT_MESSAGE_TYPE_PACKET_END: - *packet = bt_message_packet_end_borrow_packet_const(msg); - *stream = bt_packet_borrow_stream_const(*packet); - break; - default: - break; - } -} - enum bt_message_iterator_status bt_self_component_port_input_message_iterator_next( struct bt_self_component_port_input_message_iterator *iterator, @@ -750,6 +718,8 @@ bt_port_output_message_iterator_create(struct bt_graph *graph, (void *) graph, "Output port is not part of graph: %![graph-]+g, %![port-]+p", graph, output_port); + BT_ASSERT_PRE(!graph->has_sink, + "Graph already has a sink component: %![graph-]+g"); /* Create message iterator */ BT_LIB_LOGD("Creating message iterator on output port: " @@ -912,6 +882,7 @@ bt_bool bt_self_component_port_input_message_iterator_can_seek_beginning( return can; } +BT_ASSERT_PRE_FUNC static inline void _set_iterator_state_after_seeking( struct bt_self_component_port_input_message_iterator *iterator, @@ -944,7 +915,7 @@ void _set_iterator_state_after_seeking( #ifdef BT_DEV_MODE # define set_iterator_state_after_seeking _set_iterator_state_after_seeking #else -# define set_iterator_state_after_seeking(_iter, _status) +# define set_iterator_state_after_seeking(_iter, _status) ((void) _iter); ((void) _status); #endif enum bt_message_iterator_status