projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handle negative time and offset from Epoch
[babeltrace.git]
/
formats
/
ctf
/
ir
/
clock.c
diff --git
a/formats/ctf/ir/clock.c
b/formats/ctf/ir/clock.c
index 22a5d7475e30083b90dd9ae741f7718a99cbe4b4..bf2fbda5b2627b8cffb9584650ff1a81921b2afa 100644
(file)
--- a/
formats/ctf/ir/clock.c
+++ b/
formats/ctf/ir/clock.c
@@
-28,14
+28,14
@@
#include <babeltrace/ctf-ir/clock-internal.h>
#include <babeltrace/ctf-ir/utils.h>
#include <babeltrace/ctf-ir/clock-internal.h>
#include <babeltrace/ctf-ir/utils.h>
-#include <babeltrace/ctf-ir/common-internal.h>
-#include <babeltrace/ctf-ir/ref.h>
+#include <babeltrace/ref.h>
#include <babeltrace/ctf-writer/writer-internal.h>
#include <babeltrace/ctf-writer/writer-internal.h>
+#include <babeltrace/object-internal.h>
#include <babeltrace/compiler.h>
#include <inttypes.h>
static
#include <babeltrace/compiler.h>
#include <inttypes.h>
static
-void bt_ctf_clock_destroy(struct bt_
ref *ref
);
+void bt_ctf_clock_destroy(struct bt_
object *obj
);
BT_HIDDEN
struct bt_ctf_clock *_bt_ctf_clock_create(void)
BT_HIDDEN
struct bt_ctf_clock *_bt_ctf_clock_create(void)
@@
-49,7
+49,7
@@
struct bt_ctf_clock *_bt_ctf_clock_create(void)
clock->precision = 1;
clock->frequency = 1000000000;
clock->precision = 1;
clock->frequency = 1000000000;
- bt_
ctf_base
_init(clock, bt_ctf_clock_destroy);
+ bt_
object
_init(clock, bt_ctf_clock_destroy);
end:
return clock;
}
end:
return clock;
}
@@
-91,20
+91,19
@@
struct bt_ctf_clock *bt_ctf_clock_create(const char *name)
ret = bt_ctf_clock_set_name(clock, name);
if (ret) {
ret = bt_ctf_clock_set_name(clock, name);
if (ret) {
- goto error
_destroy
;
+ goto error;
}
}
- ret = b
abeltrace
_uuid_generate(clock->uuid);
+ ret = b
t
_uuid_generate(clock->uuid);
if (ret) {
if (ret) {
- goto error
_destroy
;
+ goto error;
}
clock->uuid_set = 1;
return clock;
}
clock->uuid_set = 1;
return clock;
-error_destroy:
- bt_ctf_clock_destroy(&clock->base.ref_count);
error:
error:
- return NULL;
+ BT_PUT(clock);
+ return clock;
}
const char *bt_ctf_clock_get_name(struct bt_ctf_clock *clock)
}
const char *bt_ctf_clock_get_name(struct bt_ctf_clock *clock)
@@
-207,20
+206,21
@@
end:
return ret;
}
return ret;
}
-
uint64_t bt_ctf_clock_get_offset_s(struct bt_ctf_clock *clock
)
+
int bt_ctf_clock_get_offset_s(struct bt_ctf_clock *clock, int64_t *offset_s
)
{
{
-
uint64_t ret = -1ULL
;
+
int ret = 0
;
- if (!clock) {
+ if (!clock || !offset_s) {
+ ret = -1;
goto end;
}
goto end;
}
-
ret
= clock->offset_s;
+
*offset_s
= clock->offset_s;
end:
return ret;
}
end:
return ret;
}
-int bt_ctf_clock_set_offset_s(struct bt_ctf_clock *clock,
u
int64_t offset_s)
+int bt_ctf_clock_set_offset_s(struct bt_ctf_clock *clock, int64_t offset_s)
{
int ret = 0;
{
int ret = 0;
@@
-234,20
+234,21
@@
end:
return ret;
}
return ret;
}
-
uint64_t bt_ctf_clock_get_offset(struct bt_ctf_clock *clock
)
+
int bt_ctf_clock_get_offset(struct bt_ctf_clock *clock, int64_t *offset
)
{
{
-
uint64_t ret = -1ULL
;
+
int ret = 0
;
- if (!clock) {
+ if (!clock || !offset) {
+ ret = -1;
goto end;
}
goto end;
}
-
r
et = clock->offset;
+
*offs
et = clock->offset;
end:
return ret;
}
end:
return ret;
}
-int bt_ctf_clock_set_offset(struct bt_ctf_clock *clock,
u
int64_t offset)
+int bt_ctf_clock_set_offset(struct bt_ctf_clock *clock, int64_t offset)
{
int ret = 0;
{
int ret = 0;
@@
-317,20
+318,21
@@
end:
return ret;
}
return ret;
}
-
uint64_t bt_ctf_clock_get_time(struct bt_ctf_clock *clock
)
+
int bt_ctf_clock_get_time(struct bt_ctf_clock *clock, int64_t *time
)
{
{
-
uint64_t ret = -1ULL
;
+
int ret = 0
;
- if (!clock) {
+ if (!clock || !time) {
+ ret = -1;
goto end;
}
goto end;
}
-
ret
= clock->time;
+
*time
= clock->time;
end:
return ret;
}
end:
return ret;
}
-int bt_ctf_clock_set_time(struct bt_ctf_clock *clock,
u
int64_t time)
+int bt_ctf_clock_set_time(struct bt_ctf_clock *clock, int64_t time)
{
int ret = 0;
{
int ret = 0;
@@
-347,12
+349,12
@@
end:
void bt_ctf_clock_get(struct bt_ctf_clock *clock)
{
void bt_ctf_clock_get(struct bt_ctf_clock *clock)
{
- bt_
ctf_
get(clock);
+ bt_get(clock);
}
void bt_ctf_clock_put(struct bt_ctf_clock *clock)
{
}
void bt_ctf_clock_put(struct bt_ctf_clock *clock)
{
- bt_
ctf_
put(clock);
+ bt_put(clock);
}
BT_HIDDEN
}
BT_HIDDEN
@@
-404,17
+406,11
@@
void bt_ctf_clock_serialize(struct bt_ctf_clock *clock,
}
static
}
static
-void bt_ctf_clock_destroy(struct bt_
ref *ref
)
+void bt_ctf_clock_destroy(struct bt_
object *obj
)
{
struct bt_ctf_clock *clock;
{
struct bt_ctf_clock *clock;
- struct bt_ctf_base *base;
-
- if (!ref) {
- return;
- }
- base = container_of(ref, struct bt_ctf_base, ref_count);
- clock = container_of(base, struct bt_ctf_clock, base);
+ clock = container_of(obj, struct bt_ctf_clock, base);
if (clock->name) {
g_string_free(clock->name, TRUE);
}
if (clock->name) {
g_string_free(clock->name, TRUE);
}
This page took
0.048237 seconds
and
4
git commands to generate.