doc/api/libbabeltrace2/DoxygenLayout.xml: use `topics` tab
[babeltrace.git] / src / plugins / utils / dummy / dummy.c
index 93394029fd868a02d458a9895c43b69c5d7c0500..e237bcbd257919f389137c214a6127b41f286e0e 100644 (file)
@@ -44,9 +44,9 @@ struct bt_param_validation_map_value_entry_descr dummy_params[] = {
 
 bt_component_class_initialize_method_status dummy_init(
                bt_self_component_sink *self_comp_sink,
-               bt_self_component_sink_configuration *config,
+               bt_self_component_sink_configuration *config __attribute__((unused)),
                const bt_value *params,
-               __attribute__((unused)) void *init_method_data)
+               void *init_method_data __attribute__((unused)))
 {
        bt_self_component *self_comp =
                bt_self_component_sink_as_self_component(self_comp_sink);
@@ -127,51 +127,37 @@ end:
 bt_component_class_sink_consume_method_status dummy_consume(
                bt_self_component_sink *component)
 {
-       bt_component_class_sink_consume_method_status status =
-               BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
        bt_message_array_const msgs;
        uint64_t count;
        struct dummy *dummy;
        bt_message_iterator_next_status next_status;
        uint64_t i;
+       bt_self_component *self_comp =
+               bt_self_component_sink_as_self_component(component);
 
-       dummy = bt_self_component_get_data(
-               bt_self_component_sink_as_self_component(component));
+       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(
                dummy->msg_iter, &msgs, &count);
        switch (next_status) {
        case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
-               status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
-
                for (i = 0; i < count; i++) {
                        bt_message_put_ref(msgs[i]);
                }
 
                break;
-       case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
-               status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN;
-               goto end;
-       case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
-               status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
-               goto end;
        case BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR:
-               status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
-               goto end;
        case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
-               status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR;
-               goto end;
+               BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(
+                       self_comp,
+                       "Failed to get messages from upstream component");
+               break;
        default:
                break;
        }
 
-end:
-       return status;
+       return (int) next_status;
 }
This page took 0.025248 seconds and 4 git commands to generate.