From bf3ab6f60ac4fe4337eecd27713592cdbb37f27b Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 5 Dec 2023 03:38:56 +0000 Subject: [PATCH] src.ctf.fs: remove ctf_fs_file_destroy Remove it, and the custom deleter, now that a ctf_fs_file can be simply deleted. Change-Id: Iaef8b0cdbe525272019e0258665b45cbaee6ad05 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/8266 Reviewed-by: Philippe Proulx Reviewed-on: https://review.lttng.org/c/babeltrace/+/12304 Tested-by: jenkins --- src/plugins/ctf/fs-src/file.cpp | 17 ++--------------- src/plugins/ctf/fs-src/file.hpp | 9 +-------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/plugins/ctf/fs-src/file.cpp b/src/plugins/ctf/fs-src/file.cpp index e3f7d778..56c9c451 100644 --- a/src/plugins/ctf/fs-src/file.cpp +++ b/src/plugins/ctf/fs-src/file.cpp @@ -8,27 +8,14 @@ #include #include +#include "cpp-common/bt2s/make-unique.hpp" #include "cpp-common/vendor/fmt/format.h" #include "file.hpp" -void ctf_fs_file_destroy(struct ctf_fs_file *file) -{ - if (!file) { - return; - } - - delete file; -} - -void ctf_fs_file_deleter::operator()(ctf_fs_file * const file) noexcept -{ - ctf_fs_file_destroy(file); -} - ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger) { - return ctf_fs_file::UP {new ctf_fs_file {parentLogger}}; + return bt2s::make_unique(parentLogger); } 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 5f0ca395..d367cb50 100644 --- a/src/plugins/ctf/fs-src/file.hpp +++ b/src/plugins/ctf/fs-src/file.hpp @@ -15,14 +15,9 @@ #include "cpp-common/bt2c/libc-up.hpp" #include "cpp-common/bt2c/logging.hpp" -struct ctf_fs_file_deleter -{ - void operator()(struct ctf_fs_file *file) noexcept; -}; - struct ctf_fs_file { - using UP = std::unique_ptr; + using UP = std::unique_ptr; explicit ctf_fs_file(const bt2c::Logger& parentLogger) : logger {parentLogger, "PLUGIN/SRC.CTF.FS/FILE"} @@ -38,8 +33,6 @@ struct ctf_fs_file off_t size = 0; }; -void ctf_fs_file_destroy(struct ctf_fs_file *file); - ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger); int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode); -- 2.34.1