X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Futils%2Fcounter%2Fcounter.c;h=406a76ee6326ba991626a6e40a92945ec2e8a4b8;hb=f6ccaed94e575af57fe6bf38154771bee4871a2a;hp=a1c1cd4b314a3abe3f4be4929ee3f9b6b91a4f50;hpb=358340ece4f5ce33eee2c763c86a18383e0ccc85;p=babeltrace.git diff --git a/plugins/utils/counter/counter.c b/plugins/utils/counter/counter.c index a1c1cd4b..406a76ee 100644 --- a/plugins/utils/counter/counter.c +++ b/plugins/utils/counter/counter.c @@ -20,24 +20,11 @@ * SOFTWARE. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include -#include #include -#include +#include #include #include @@ -133,9 +120,9 @@ void counter_finalize(struct bt_private_component *component) { struct counter *counter; - assert(component); + BT_ASSERT(component); counter = bt_private_component_get_user_data(component); - assert(counter); + BT_ASSERT(counter); try_print_last(counter); bt_put(counter->notif_iter); g_free(counter); @@ -163,11 +150,10 @@ enum bt_component_status counter_init(struct bt_private_component *component, counter->last_printed_total = -1ULL; counter->step = 1000; step = bt_value_map_get(params, "step"); - if (bt_value_is_integer(step)) { + if (step && bt_value_is_integer(step)) { int64_t val; - int vret = bt_value_integer_get(step, &val); - assert(vret == 0); + (void) bt_value_integer_get(step, &val); if (val >= 0) { counter->step = (uint64_t) val; @@ -175,11 +161,10 @@ enum bt_component_status counter_init(struct bt_private_component *component, } hide_zero = bt_value_map_get(params, "hide-zero"); - if (bt_value_is_bool(hide_zero)) { + if (hide_zero && bt_value_is_bool(hide_zero)) { bt_bool val; - int vret = bt_value_bool_get(hide_zero, &val); - assert(vret == 0); + (void) bt_value_bool_get(hide_zero, &val); counter->hide_zero = (bool) val; } @@ -210,9 +195,9 @@ void counter_port_connected( enum bt_connection_status conn_status; counter = bt_private_component_get_user_data(component); - assert(counter); + BT_ASSERT(counter); connection = bt_private_port_get_private_connection(self_port); - assert(connection); + BT_ASSERT(connection); conn_status = bt_private_connection_create_notification_iterator( connection, NULL, &iterator); if (conn_status != BT_CONNECTION_STATUS_OK) { @@ -235,7 +220,7 @@ enum bt_component_status counter_consume(struct bt_private_component *component) int64_t count; counter = bt_private_component_get_user_data(component); - assert(counter); + BT_ASSERT(counter); if (unlikely(counter->error)) { ret = BT_COMPONENT_STATUS_ERROR; @@ -268,7 +253,7 @@ enum bt_component_status counter_consume(struct bt_private_component *component) struct bt_notification *notif = bt_notification_iterator_get_notification(counter->notif_iter); - assert(notif); + BT_ASSERT(notif); switch (bt_notification_get_type(notif)) { case BT_NOTIFICATION_TYPE_EVENT: counter->count.event++;