lib: rename `bt_object_{get,put}_no` -> `bt_object_{get,put}_ref_no`
[babeltrace.git] / src / lib / trace-ir / clock-snapshot.c
index 19e6781673efbeff125c3ff33082118656eb920d..2762332681acba7f0e7f3430312054334a09fbb5 100644 (file)
@@ -63,7 +63,7 @@ struct bt_clock_snapshot *bt_clock_snapshot_new(
 
        bt_object_init_unique(&ret->base);
        ret->clock_class = clock_class;
-       bt_object_get_no_null_check(clock_class);
+       bt_object_get_ref_no_null_check(clock_class);
        bt_clock_class_freeze(clock_class);
        BT_LIB_LOGD("Created clock snapshot object: %!+k", ret);
 
@@ -83,20 +83,12 @@ struct bt_clock_snapshot *bt_clock_snapshot_create(
                BT_LIB_LOGE_APPEND_CAUSE(
                        "Cannot allocate one clock snapshot from clock class's clock snapshot pool: "
                        "%![cc-]+K", clock_class);
-               goto error;
+               goto end;
        }
 
        if (G_LIKELY(!clock_snapshot->clock_class)) {
                clock_snapshot->clock_class = clock_class;
-               bt_object_get_no_null_check(clock_class);
-       }
-
-       goto end;
-
-error:
-       if (clock_snapshot) {
-               bt_clock_snapshot_recycle(clock_snapshot);
-               clock_snapshot = NULL;
+               bt_object_get_ref_no_null_check(clock_class);
        }
 
 end:
@@ -144,8 +136,8 @@ void bt_clock_snapshot_recycle(struct bt_clock_snapshot *clock_snapshot)
 uint64_t bt_clock_snapshot_get_value(
                const struct bt_clock_snapshot *clock_snapshot)
 {
-       BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
-       BT_ASSERT_PRE(clock_snapshot->is_set,
+       BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot");
+       BT_ASSERT_PRE_DEV(clock_snapshot->is_set,
                "Clock snapshot is not set: %!+k", clock_snapshot);
        return clock_snapshot->value_cycles;
 }
@@ -157,16 +149,17 @@ bt_clock_snapshot_get_ns_from_origin(
 {
        int ret = BT_FUNC_STATUS_OK;
 
-       BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
-       BT_ASSERT_PRE_NON_NULL(ret_value_ns, "Value (ns) (output)");
-       BT_ASSERT_PRE(clock_snapshot->is_set,
+       BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot");
+       BT_ASSERT_PRE_DEV_NON_NULL(ret_value_ns, "Value (ns) (output)");
+       BT_ASSERT_PRE_DEV(clock_snapshot->is_set,
                "Clock snapshot is not set: %!+k", clock_snapshot);
 
        if (clock_snapshot->ns_from_origin_overflows) {
-               BT_LIB_LOGD("Clock snapshot, once converted to nanoseconds from origin, "
+               BT_LIB_LOGE_APPEND_CAUSE(
+                       "Clock snapshot, once converted to nanoseconds from origin, "
                        "overflows the signed 64-bit integer range: "
                        "%![cs-]+k", clock_snapshot);
-               ret = BT_FUNC_STATUS_OVERFLOW;
+               ret = BT_FUNC_STATUS_OVERFLOW_ERROR;
                goto end;
        }
 
@@ -179,6 +172,6 @@ end:
 const struct bt_clock_class *bt_clock_snapshot_borrow_clock_class_const(
                const struct bt_clock_snapshot *clock_snapshot)
 {
-       BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
+       BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot");
        return clock_snapshot->clock_class;
 }
This page took 0.033601 seconds and 4 git commands to generate.