From: Simon Marchi Date: Tue, 26 Jul 2022 21:19:35 +0000 (-0400) Subject: src.ctf.fs: remove ctf_fs_file_create X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=81432af2960911d553b742afb5dca565dc120b70;p=deliverable%2Fbabeltrace.git src.ctf.fs: remove ctf_fs_file_create Remove this function, it's now just a wrapper around constructing a ctf_fs_file. Change-Id: I95e4d6eb26b0d359e0f480cac51af11f3a1db539 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/8297 Reviewed-by: Philippe Proulx --- diff --git a/src/plugins/ctf/fs-src/data-stream-file.cpp b/src/plugins/ctf/fs-src/data-stream-file.cpp index d33d8c86c..88614d573 100644 --- a/src/plugins/ctf/fs-src/data-stream-file.cpp +++ b/src/plugins/ctf/fs-src/data-stream-file.cpp @@ -803,11 +803,7 @@ ctf_fs_ds_file::UP ctf_fs_ds_file_create(struct ctf_fs_trace *ctf_fs_trace, const size_t offset_align = bt_mmap_get_offset_align_size(logCfg.logLevel()); ctf_fs_ds_file::UP ds_file = bt2_common::makeUnique(logCfg); - ds_file->file = ctf_fs_file_create(logCfg); - if (!ds_file->file) { - goto error; - } - + ds_file->file = bt2_common::makeUnique(logCfg); ds_file->stream = std::move(stream); ds_file->metadata = ctf_fs_trace->metadata.get(); ds_file->file->path = path; diff --git a/src/plugins/ctf/fs-src/file.cpp b/src/plugins/ctf/fs-src/file.cpp index a56d99e0e..d3cc83bc3 100644 --- a/src/plugins/ctf/fs-src/file.cpp +++ b/src/plugins/ctf/fs-src/file.cpp @@ -16,12 +16,6 @@ #include "cpp-common/cfg-logging.hpp" #include "cpp-common/cfg-logging-error-reporting.hpp" -BT_HIDDEN -ctf_fs_file::UP ctf_fs_file_create(const bt2_common::LogCfg& logCfg) -{ - return ctf_fs_file::UP {new ctf_fs_file {logCfg}}; -} - BT_HIDDEN int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode) { diff --git a/src/plugins/ctf/fs-src/file.hpp b/src/plugins/ctf/fs-src/file.hpp index 269ca6ffe..db5d6da12 100644 --- a/src/plugins/ctf/fs-src/file.hpp +++ b/src/plugins/ctf/fs-src/file.hpp @@ -32,9 +32,6 @@ struct ctf_fs_file off_t size = 0; }; -BT_HIDDEN -ctf_fs_file::UP ctf_fs_file_create(const bt2_common::LogCfg& logCfg); - BT_HIDDEN int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode); diff --git a/src/plugins/ctf/fs-src/fs.cpp b/src/plugins/ctf/fs-src/fs.cpp index 79e313be2..9a1b08cab 100644 --- a/src/plugins/ctf/fs-src/fs.cpp +++ b/src/plugins/ctf/fs-src/fs.cpp @@ -628,13 +628,7 @@ static int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace) } /* Create the file. */ - ctf_fs_file::UP file = ctf_fs_file_create(logCfg); - if (!file) { - BT_CLOGE_APPEND_CAUSE("Cannot create stream file object for file `%s" G_DIR_SEPARATOR_S - "%s`", - ctf_fs_trace->path.c_str(), basename); - goto error; - } + ctf_fs_file::UP file = bt2_common::makeUnique(logCfg); /* Create full path string. */ file->path = ctf_fs_trace->path; diff --git a/src/plugins/ctf/fs-src/metadata.cpp b/src/plugins/ctf/fs-src/metadata.cpp index da17c72c0..52bb8f370 100644 --- a/src/plugins/ctf/fs-src/metadata.cpp +++ b/src/plugins/ctf/fs-src/metadata.cpp @@ -22,6 +22,7 @@ #include "metadata.hpp" #include "../common/src/metadata/tsdl/decoder.hpp" #include "cpp-common/cfg-logging.hpp" +#include "cpp-common/make-unique.hpp" BT_HIDDEN FILE *ctf_fs_metadata_open_file(const char *trace_path) @@ -43,7 +44,7 @@ end: static ctf_fs_file::UP get_file(const char *trace_path, const bt2_common::LogCfg& logCfg) { - ctf_fs_file::UP file = ctf_fs_file_create(logCfg); + ctf_fs_file::UP file = bt2_common::makeUnique(logCfg); if (!file) { goto error;