projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Unify reference counting using a common bt_object base
[babeltrace.git]
/
formats
/
ctf
/
writer
/
writer.c
diff --git
a/formats/ctf/writer/writer.c
b/formats/ctf/writer/writer.c
index 9adfcd381f22f09e5fdea1fbe41316ab6b74958b..f8a36778e39b3f1382cea2fc66bedc09f483ae1f 100644
(file)
--- a/
formats/ctf/writer/writer.c
+++ b/
formats/ctf/writer/writer.c
@@
-33,8
+33,7
@@
#include <babeltrace/ctf-writer/functor-internal.h>
#include <babeltrace/ctf-ir/stream-class-internal.h>
#include <babeltrace/ctf-ir/stream-internal.h>
#include <babeltrace/ctf-writer/functor-internal.h>
#include <babeltrace/ctf-ir/stream-class-internal.h>
#include <babeltrace/ctf-ir/stream-internal.h>
-#include <babeltrace/ctf-ir/ref.h>
-#include <babeltrace/ctf-ir/common-internal.h>
+#include <babeltrace/ref.h>
#include <babeltrace/compiler.h>
#include <stdio.h>
#include <stdlib.h>
#include <babeltrace/compiler.h>
#include <stdio.h>
#include <stdlib.h>
@@
-45,7
+44,8
@@
#include <inttypes.h>
static
#include <inttypes.h>
static
-void bt_ctf_writer_destroy(struct bt_ref *ref);
+void bt_ctf_writer_destroy(struct bt_object *obj);
+
static
int create_stream_file(struct bt_ctf_writer *writer,
struct bt_ctf_stream *stream);
static
int create_stream_file(struct bt_ctf_writer *writer,
struct bt_ctf_stream *stream);
@@
-63,7
+63,7
@@
struct bt_ctf_writer *bt_ctf_writer_create(const char *path)
goto error;
}
goto error;
}
- bt_
ctf_base
_init(writer, bt_ctf_writer_destroy);
+ bt_
object
_init(writer, bt_ctf_writer_destroy);
writer->path = g_string_new(path);
if (!writer->path) {
goto error_destroy;
writer->path = g_string_new(path);
if (!writer->path) {
goto error_destroy;
@@
-94,23
+94,16
@@
struct bt_ctf_writer *bt_ctf_writer_create(const char *path)
error_destroy:
unlinkat(writer->trace_dir_fd, "metadata", 0);
error_destroy:
unlinkat(writer->trace_dir_fd, "metadata", 0);
- bt_ctf_writer_destroy(&writer->base.ref_count);
- writer = NULL;
+ BT_PUT(writer);
error:
return writer;
}
error:
return writer;
}
-void bt_ctf_writer_destroy(struct bt_
ref *ref
)
+void bt_ctf_writer_destroy(struct bt_
object *obj
)
{
struct bt_ctf_writer *writer;
{
struct bt_ctf_writer *writer;
- struct bt_ctf_base *base;
-
- if (!ref) {
- return;
- }
- base = container_of(ref, struct bt_ctf_base, ref_count);
- writer = container_of(base, struct bt_ctf_writer, base);
+ writer = container_of(obj, struct bt_ctf_writer, base);
bt_ctf_writer_flush_metadata(writer);
if (writer->path) {
g_string_free(writer->path, TRUE);
bt_ctf_writer_flush_metadata(writer);
if (writer->path) {
g_string_free(writer->path, TRUE);
@@
-128,7
+121,7
@@
void bt_ctf_writer_destroy(struct bt_ref *ref)
}
}
}
}
- bt_
ctf_trace_
put(writer->trace);
+ bt_put(writer->trace);
g_free(writer);
}
g_free(writer);
}
@@
-141,7
+134,7
@@
struct bt_ctf_trace *bt_ctf_writer_get_trace(struct bt_ctf_writer *writer)
}
trace = writer->trace;
}
trace = writer->trace;
- bt_
ctf_trace_
get(trace);
+ bt_get(trace);
end:
return trace;
}
end:
return trace;
}
@@
-170,8
+163,8
@@
struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer,
return stream;
error:
return stream;
error:
-
bt_ctf_stream_put
(stream);
- return
NULL
;
+
BT_PUT
(stream);
+ return
stream
;
}
int bt_ctf_writer_add_environment_field(struct bt_ctf_writer *writer,
}
int bt_ctf_writer_add_environment_field(struct bt_ctf_writer *writer,
@@
-271,12
+264,12
@@
end:
void bt_ctf_writer_get(struct bt_ctf_writer *writer)
{
void bt_ctf_writer_get(struct bt_ctf_writer *writer)
{
- bt_
ctf_
get(writer);
+ bt_get(writer);
}
void bt_ctf_writer_put(struct bt_ctf_writer *writer)
{
}
void bt_ctf_writer_put(struct bt_ctf_writer *writer)
{
- bt_
ctf_
put(writer);
+ bt_put(writer);
}
static
}
static
This page took
0.02419 seconds
and
4
git commands to generate.