X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fir%2Fclock.c;h=723b860dd6e9d377ccf6e7e0f442358720caa4e4;hp=22a5d7475e30083b90dd9ae741f7718a99cbe4b4;hb=83509119a945fc77faff869daaf48627e1c4b3fa;hpb=4841ccc167f5f99267a0c129a1e79214b60f553c diff --git a/formats/ctf/ir/clock.c b/formats/ctf/ir/clock.c index 22a5d747..723b860d 100644 --- a/formats/ctf/ir/clock.c +++ b/formats/ctf/ir/clock.c @@ -28,14 +28,14 @@ #include #include -#include -#include +#include #include +#include #include #include 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) @@ -49,7 +49,7 @@ struct bt_ctf_clock *_bt_ctf_clock_create(void) 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; } @@ -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) { - goto error_destroy; + goto error; } ret = babeltrace_uuid_generate(clock->uuid); if (ret) { - goto error_destroy; + goto error; } clock->uuid_set = 1; return clock; -error_destroy: - bt_ctf_clock_destroy(&clock->base.ref_count); error: - return NULL; + BT_PUT(clock); + return clock; } const char *bt_ctf_clock_get_name(struct bt_ctf_clock *clock) @@ -347,12 +346,12 @@ end: 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) { - bt_ctf_put(clock); + bt_put(clock); } BT_HIDDEN @@ -404,17 +403,11 @@ void bt_ctf_clock_serialize(struct bt_ctf_clock *clock, } 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_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); }