#define BT_COMP_LOG_SELF_COMP (counter->self_comp)
#define BT_LOG_OUTPUT_LEVEL (counter->log_level)
#define BT_LOG_TAG "PLUGIN/FLT.UTILS.COUNTER"
-#include "plugins/comp-logging.h"
+#include "logging/comp-logging.h"
#include <babeltrace2/babeltrace.h>
#include "common/macros.h"
void destroy_private_counter_data(struct counter *counter)
{
- bt_self_component_port_input_message_iterator_put_ref(counter->msg_iter);
- g_free(counter);
+ if (counter) {
+ bt_self_component_port_input_message_iterator_put_ref(
+ counter->msg_iter);
+ g_free(counter);
+ }
}
BT_HIDDEN
BT_HIDDEN
bt_component_class_init_method_status counter_init(
bt_self_component_sink *component,
+ bt_self_component_sink_configuration *config,
const bt_value *params,
__attribute__((unused)) void *init_method_data)
{
goto error;
}
- counter->step = bt_value_unsigned_integer_get(step);
+ counter->step = bt_value_integer_unsigned_get(step);
}
hide_zero = bt_value_map_borrow_entry_value_const(params, "hide-zero");
counter_graph_is_configured(
bt_self_component_sink *comp)
{
- bt_component_class_sink_graph_is_configured_method_status status =
- BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
+ bt_component_class_sink_graph_is_configured_method_status status;
+ bt_self_component_port_input_message_iterator_create_from_sink_component_status
+ msg_iter_status;
struct counter *counter;
bt_self_component_port_input_message_iterator *iterator;
counter = bt_self_component_get_data(
bt_self_component_sink_as_self_component(comp));
BT_ASSERT(counter);
- iterator = bt_self_component_port_input_message_iterator_create(
- bt_self_component_sink_borrow_input_port_by_name(comp,
- in_port_name));
- if (!iterator) {
- status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR;
+
+ msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component(
+ comp, bt_self_component_sink_borrow_input_port_by_name(comp,
+ in_port_name), &iterator);
+ if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
+ status = (int) msg_iter_status;
goto end;
}
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
counter->msg_iter, iterator);
+ status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
end:
return status;
}