Make parent parameters const for some object creation functions
[babeltrace.git] / lib / graph / message / inactivity.c
index f61f1fdcaf0bf9b698f58850856001fdc8ac3e9d..ada6dc67fe2d75a187e4ace3be1129349cf836c2 100644 (file)
@@ -43,6 +43,7 @@ void bt_message_inactivity_destroy(struct bt_object *obj)
 
        if (message->default_cs) {
                bt_clock_snapshot_recycle(message->default_cs);
+               message->default_cs = NULL;
        }
 
        g_free(message);
@@ -50,7 +51,7 @@ void bt_message_inactivity_destroy(struct bt_object *obj)
 
 struct bt_message *bt_message_inactivity_create(
                struct bt_self_message_iterator *self_msg_iter,
-               struct bt_clock_class *default_clock_class)
+               const struct bt_clock_class *default_clock_class)
 {
        struct bt_self_component_port_input_message_iterator *msg_iter =
                (void *) self_msg_iter;
@@ -71,7 +72,8 @@ struct bt_message *bt_message_inactivity_create(
                BT_MESSAGE_TYPE_INACTIVITY,
                bt_message_inactivity_destroy, NULL);
        ret_msg = &message->parent;
-       message->default_cs = bt_clock_snapshot_create(default_clock_class);
+       message->default_cs = bt_clock_snapshot_create(
+               (void *) default_clock_class);
        if (!message->default_cs) {
                goto error;
        }
@@ -94,18 +96,20 @@ void bt_message_inactivity_set_default_clock_snapshot(
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
        BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
-       bt_clock_snapshot_set_value_inline(inactivity->default_cs, value_cycles);
+       bt_clock_snapshot_set_raw_value(inactivity->default_cs, value_cycles);
        BT_LIB_LOGV("Set inactivity message's default clock snapshot: "
                "%![msg-]+n, value=%" PRIu64, msg, value_cycles);
 }
 
-const struct bt_clock_snapshot *
+extern enum bt_clock_snapshot_state
 bt_message_inactivity_borrow_default_clock_snapshot_const(
-               const struct bt_message *msg)
+               const bt_message *msg, const bt_clock_snapshot **snapshot)
 {
        struct bt_message_inactivity *inactivity = (void *) msg;
 
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
-       return inactivity->default_cs;
+       *snapshot = inactivity->default_cs;
+       return BT_CLOCK_SNAPSHOT_STATE_KNOWN;
 }
This page took 0.024353 seconds and 4 git commands to generate.