Fix: lib: usage of output port message iterator
[babeltrace.git] / lib / graph / iterator.c
index 5f9f21c351b812a1c41440eb5697ce11f080751c..eba243739fdc07eeafcb0915f784936f884cb59b 100644 (file)
@@ -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
@@ -791,11 +792,14 @@ bt_port_output_message_iterator_create(struct bt_graph *graph,
         */
        bt_graph_set_can_consume(iterator->graph, false);
 
-       /*
-        * Also set the graph as being configured: it has no active sink
-        * anyway, so we don't need to call bt_graph_configure().
-        */
-       graph->config_state = BT_GRAPH_CONFIGURATION_STATE_CONFIGURED;
+       /* Also set the graph as being configured. */
+       graph_status = bt_graph_configure(graph);
+       if (graph_status != BT_GRAPH_STATUS_OK) {
+               BT_LIB_LOGW("Cannot configure graph after having added colander: "
+                       "%![graph-]+g, status=%s", graph,
+                       bt_graph_status_string(graph_status));
+               goto error;
+       }
        goto end;
 
 error:
@@ -881,6 +885,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,
@@ -913,7 +918,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
This page took 0.025336 seconds and 4 git commands to generate.