sink.utils.dummy: remove unnecessary check in dummy_consume()
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Mar 2024 21:05:05 +0000 (16:05 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 26 Mar 2024 18:56:36 +0000 (14:56 -0400)
Given the lifecycle of a component, I'm pretty sure this condition can
never be true.  For dummy_consume() to be called,
dummy_graph_is_configured() must execute successfully.  If
dummy_graph_is_configured() executes successfully, `dummy->msg_iter` is
necessarily set.

Change-Id: I5c11c6b76c8cb267f0185c1a35bc2f5e70826509
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12009
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/utils/dummy/dummy.c

index 330a68632924890647b3dff2f44acef3c555bf5a..e237bcbd257919f389137c214a6127b41f286e0e 100644 (file)
@@ -127,7 +127,6 @@ end:
 bt_component_class_sink_consume_method_status dummy_consume(
                bt_self_component_sink *component)
 {
-       bt_component_class_sink_consume_method_status status;
        bt_message_array_const msgs;
        uint64_t count;
        struct dummy *dummy;
@@ -138,11 +137,7 @@ bt_component_class_sink_consume_method_status dummy_consume(
 
        dummy = bt_self_component_get_data(self_comp);
        BT_ASSERT_DBG(dummy);
-
-       if (G_UNLIKELY(!dummy->msg_iter)) {
-               status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
-               goto end;
-       }
+       BT_ASSERT_DBG(dummy->msg_iter);
 
        /* Consume one message  */
        next_status = bt_message_iterator_next(
@@ -164,8 +159,5 @@ bt_component_class_sink_consume_method_status dummy_consume(
                break;
        }
 
-       status = (int) next_status;
-
-end:
-       return status;
+       return (int) next_status;
 }
This page took 0.025122 seconds and 4 git commands to generate.