Change-Id: I342285ece6b6d68c2375658cb0aff2b363b4b156
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8241
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12280
-static struct ctf_fs_trace *ctf_fs_trace_create(const char *path, const char *name,
- const ctf::src::ClkClsCfg& clkClsCfg,
- bt_self_component *selfComp,
- const bt2c::Logger& parentLogger)
+static ctf_fs_trace::UP ctf_fs_trace_create(const char *path, const char *name,
+ const ctf::src::ClkClsCfg& clkClsCfg,
+ bt_self_component *selfComp,
+ const bt2c::Logger& parentLogger)
- ctf_fs_trace *ctf_fs_trace = new struct ctf_fs_trace(parentLogger);
+ ctf_fs_trace::UP ctf_fs_trace {new struct ctf_fs_trace(parentLogger)};
ctf_fs_trace->path = g_string_new(path);
if (!ctf_fs_trace->path) {
goto error;
ctf_fs_trace->path = g_string_new(path);
if (!ctf_fs_trace->path) {
goto error;
- ret = ctf_fs_metadata_set_trace_class(selfComp, ctf_fs_trace, clkClsCfg);
+ ret = ctf_fs_metadata_set_trace_class(selfComp, ctf_fs_trace.get(), clkClsCfg);
- ret = create_ds_file_groups(ctf_fs_trace);
+ ret = create_ds_file_groups(ctf_fs_trace.get());
- ctf_fs_trace_destroy(ctf_fs_trace);
- ctf_fs_trace = NULL;
end:
return ctf_fs_trace;
end:
return ctf_fs_trace;
const char *trace_name, GPtrArray *traces,
bt_self_component *selfComp)
{
const char *trace_name, GPtrArray *traces,
bt_self_component *selfComp)
{
- struct ctf_fs_trace *ctf_fs_trace;
+ ctf_fs_trace::UP ctf_fs_trace;
int ret;
GString *norm_path;
int ret;
GString *norm_path;
- g_ptr_array_add(traces, ctf_fs_trace);
- ctf_fs_trace = NULL;
+ g_ptr_array_add(traces, ctf_fs_trace.release());