lib: make values API const-correct
[babeltrace.git] / plugins / text / dmesg / dmesg.c
index 36efc583ed6a886e78dd93c8b5ed9ba583455403..8a9d4fffd6535179060300967ced056e42a76877 100644 (file)
@@ -163,7 +163,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts)
 
                ret = bt_private_stream_class_set_default_clock_class(
                        dmesg_comp->stream_class,
-                       bt_private_clock_class_borrow_clock_class(
+                       bt_private_clock_class_as_clock_class(
                                dmesg_comp->clock_class));
                if (ret) {
                        BT_LOGE_STR("Cannot set stream class's default clock class.");
@@ -212,14 +212,15 @@ end:
 }
 
 static
-int handle_params(struct dmesg_component *dmesg_comp, struct bt_value *params)
+int handle_params(struct dmesg_component *dmesg_comp,
+               const struct bt_value *params)
 {
-       struct bt_value *no_timestamp = NULL;
-       struct bt_value *path = NULL;
+       const struct bt_value *no_timestamp = NULL;
+       const struct bt_value *path = NULL;
        const char *path_str;
        int ret = 0;
 
-       no_timestamp = bt_value_map_borrow_entry_value(params,
+       no_timestamp = bt_value_map_borrow_entry_value_const(params,
                "no-extract-timestamp");
        if (no_timestamp) {
                if (!bt_value_is_bool(no_timestamp)) {
@@ -234,7 +235,7 @@ int handle_params(struct dmesg_component *dmesg_comp, struct bt_value *params)
                        bt_value_bool_get(no_timestamp);
        }
 
-       path = bt_value_map_borrow_entry_value(params, "path");
+       path = bt_value_map_borrow_entry_value_const(params, "path");
        if (path) {
                if (dmesg_comp->params.read_from_stdin) {
                        BT_LOGE_STR("Cannot specify both `read-from-stdin` and `path` parameters.");
@@ -399,14 +400,14 @@ enum bt_self_component_status dmesg_init(
        }
 
        bt_self_component_set_data(
-               bt_self_component_source_borrow_self_component(self_comp),
+               bt_self_component_source_as_self_component(self_comp),
                dmesg_comp);
        goto end;
 
 error:
        destroy_dmesg_component(dmesg_comp);
        bt_self_component_set_data(
-               bt_self_component_source_borrow_self_component(self_comp),
+               bt_self_component_source_as_self_component(self_comp),
                NULL);
 
        if (status >= 0) {
@@ -421,7 +422,7 @@ BT_HIDDEN
 void dmesg_finalize(struct bt_self_component_source *self_comp)
 {
        destroy_dmesg_component(bt_self_component_get_data(
-               bt_self_component_source_borrow_self_component(self_comp)));
+               bt_self_component_source_as_self_component(self_comp)));
 }
 
 static
@@ -511,8 +512,7 @@ skip_ts:
        BT_ASSERT(event);
 
        if (dmesg_comp->clock_class) {
-               ret = bt_private_event_set_default_clock_value(event, ts);
-               BT_ASSERT(ret == 0);
+               bt_private_event_set_default_clock_value(event, ts);
        }
 
        goto end;
@@ -640,7 +640,7 @@ enum bt_self_notification_iterator_status dmesg_notif_iter_init(
        }
 
        dmesg_comp = bt_self_component_get_data(
-               bt_self_component_source_borrow_self_component(self_comp));
+               bt_self_component_source_as_self_component(self_comp));
        BT_ASSERT(dmesg_comp);
        dmesg_notif_iter->dmesg_comp = dmesg_comp;
        dmesg_notif_iter->pc_notif_iter = self_notif_iter;
@@ -820,7 +820,7 @@ enum bt_self_notification_iterator_status dmesg_notif_iter_next(
 
                status = dmesg_notif_iter_next_one(dmesg_notif_iter,
                        &priv_notif);
-               notifs[i] = bt_private_notification_borrow_notification(
+               notifs[i] = bt_private_notification_as_notification(
                        priv_notif);
                if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) {
                        i++;
This page took 0.0275 seconds and 4 git commands to generate.