return ret;
}
-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)
{
int ret;
- 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;
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);
if (ret) {
goto error;
}
}
}
- ret = create_ds_file_groups(ctf_fs_trace);
+ ret = create_ds_file_groups(ctf_fs_trace.get());
if (ret) {
goto error;
}
goto end;
error:
- ctf_fs_trace_destroy(ctf_fs_trace);
- ctf_fs_trace = NULL;
+ ctf_fs_trace.reset();
end:
return ctf_fs_trace;
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;
goto error;
}
- g_ptr_array_add(traces, ctf_fs_trace);
- ctf_fs_trace = NULL;
+ g_ptr_array_add(traces, ctf_fs_trace.release());
ret = 0;
goto end;