lib: make values API const-correct
[babeltrace.git] / plugins / utils / counter / counter.c
index f9ce107fba52b935e55cf19dc9e39df87cf01657..7b82ae4a84e084229e9bd2eb081d6fdc37f0793b 100644 (file)
@@ -114,7 +114,7 @@ void counter_finalize(struct bt_self_component_sink *comp)
 
        BT_ASSERT(comp);
        counter = bt_self_component_get_data(
-                       bt_self_component_sink_borrow_self_component(comp));
+                       bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
        try_print_last(counter);
        bt_object_put_ref(counter->notif_iter);
@@ -124,12 +124,13 @@ void counter_finalize(struct bt_self_component_sink *comp)
 BT_HIDDEN
 enum bt_self_component_status counter_init(
                struct bt_self_component_sink *component,
-               struct bt_value *params, UNUSED_VAR void *init_method_data)
+               const struct bt_value *params,
+               UNUSED_VAR void *init_method_data)
 {
        enum bt_self_component_status ret;
        struct counter *counter = g_new0(struct counter, 1);
-       struct bt_value *step = NULL;
-       struct bt_value *hide_zero = NULL;
+       const struct bt_value *step = NULL;
+       const struct bt_value *hide_zero = NULL;
 
        if (!counter) {
                ret = BT_SELF_COMPONENT_STATUS_NOMEM;
@@ -144,7 +145,7 @@ enum bt_self_component_status counter_init(
 
        counter->last_printed_total = -1ULL;
        counter->step = 1000;
-       step = bt_value_map_borrow_entry_value(params, "step");
+       step = bt_value_map_borrow_entry_value_const(params, "step");
        if (step && bt_value_is_integer(step)) {
                int64_t val;
 
@@ -154,7 +155,7 @@ enum bt_self_component_status counter_init(
                }
        }
 
-       hide_zero = bt_value_map_borrow_entry_value(params, "hide-zero");
+       hide_zero = bt_value_map_borrow_entry_value_const(params, "hide-zero");
        if (hide_zero && bt_value_is_bool(hide_zero)) {
                bt_bool val;
 
@@ -163,7 +164,7 @@ enum bt_self_component_status counter_init(
        }
 
        bt_self_component_set_data(
-               bt_self_component_sink_borrow_self_component(component),
+               bt_self_component_sink_as_self_component(component),
                counter);
        goto end;
 
@@ -185,7 +186,7 @@ enum bt_self_component_status counter_port_connected(
        struct bt_self_component_port_input_notification_iterator *iterator;
 
        counter = bt_self_component_get_data(
-               bt_self_component_sink_borrow_self_component(comp));
+               bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
        iterator = bt_self_component_port_input_notification_iterator_create(
                self_port);
@@ -211,7 +212,7 @@ enum bt_self_component_status counter_consume(
        bt_notification_array notifs;
 
        counter = bt_self_component_get_data(
-                       bt_self_component_sink_borrow_self_component(comp));
+                       bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
 
        if (unlikely(!counter->notif_iter)) {
This page took 0.024664 seconds and 4 git commands to generate.