Change-Id: I9f115907d062db0a227a49adb7d5786342ca4147
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8263
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12301
-static struct ctf_fs_file *get_file(const char *trace_path, const bt2c::Logger& logger)
+static ctf_fs_file::UP get_file(const char *trace_path, const bt2c::Logger& logger)
- struct ctf_fs_file *file = ctf_fs_file_create(logger).release();
+ auto file = ctf_fs_file_create(logger);
g_string_append(file->path, trace_path);
g_string_append(file->path, G_DIR_SEPARATOR_S CTF_FS_METADATA_FILENAME);
g_string_append(file->path, trace_path);
g_string_append(file->path, G_DIR_SEPARATOR_S CTF_FS_METADATA_FILENAME);
- if (ctf_fs_file_open(file, "rb")) {
+ if (ctf_fs_file_open(file.get(), "rb")) {
goto error;
}
goto end;
error:
goto error;
}
goto end;
error:
- if (file) {
- ctf_fs_file_destroy(file);
- file = NULL;
- }
const ctf::src::ClkClsCfg& clkClsCfg)
{
int ret = 0;
const ctf::src::ClkClsCfg& clkClsCfg)
{
int ret = 0;
- struct ctf_fs_file *file = NULL;
ctf_metadata_decoder_config decoder_config {ctf_fs_trace->logger};
decoder_config.self_comp = self_comp;
decoder_config.clkClsCfg = clkClsCfg;
decoder_config.create_trace_class = true;
ctf_metadata_decoder_config decoder_config {ctf_fs_trace->logger};
decoder_config.self_comp = self_comp;
decoder_config.clkClsCfg = clkClsCfg;
decoder_config.create_trace_class = true;
- file = get_file(ctf_fs_trace->path->str, ctf_fs_trace->logger);
+ const auto file = get_file(ctf_fs_trace->path->str, ctf_fs_trace->logger);
if (!file) {
BT_CPPLOGE_SPEC(ctf_fs_trace->logger, "Cannot create metadata file object.");
ret = -1;
if (!file) {
BT_CPPLOGE_SPEC(ctf_fs_trace->logger, "Cannot create metadata file object.");
ret = -1;
BT_ASSERT(ctf_fs_trace->metadata->tc);
end:
BT_ASSERT(ctf_fs_trace->metadata->tc);
end:
- ctf_fs_file_destroy(file);