From c6a7ea93dbe7b3ff25f3b22a1cc53fc8a63acd98 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 5 Mar 2024 16:05:05 -0500 Subject: [PATCH] sink.utils.counter: remove unnecessary check in counter_consume() Given the lifecycle of a component, I'm pretty sure this condition can never be true. For counter_consume() to be called, counter_graph_is_configured() must execute successfully. If counter_graph_is_configured() executes successfully, `counter->msg_iter` is necessarily set. Signed-off-by: Simon Marchi Change-Id: Ibd3cbcfdeefa8d79143e39c6fb846ca5eeebd249 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12010 Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/plugins/utils/counter/counter.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/plugins/utils/counter/counter.c b/src/plugins/utils/counter/counter.c index 24cf37fe..0ef6b820 100644 --- a/src/plugins/utils/counter/counter.c +++ b/src/plugins/utils/counter/counter.c @@ -230,7 +230,6 @@ end: bt_component_class_sink_consume_method_status counter_consume( bt_self_component_sink *comp) { - bt_component_class_sink_consume_method_status status; struct counter *counter; bt_message_iterator_next_status next_status; uint64_t msg_count; @@ -240,12 +239,7 @@ bt_component_class_sink_consume_method_status counter_consume( counter = bt_self_component_get_data(self_comp); BT_ASSERT_DBG(counter); - - if (G_UNLIKELY(!counter->msg_iter)) { - try_print_last(counter); - status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END; - goto end; - } + BT_ASSERT_DBG(counter->msg_iter); /* Consume messages */ next_status = bt_message_iterator_next( @@ -307,8 +301,5 @@ bt_component_class_sink_consume_method_status counter_consume( break; } - status = (int) next_status; - -end: - return status; + return (int) next_status; } -- 2.34.1