src.ctf.fs: remove ctf_fs_file_destroy
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Dec 2023 03:38:56 +0000 (03:38 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
Remove it, and the custom deleter, now that a ctf_fs_file can be simply
deleted.

Change-Id: Iaef8b0cdbe525272019e0258665b45cbaee6ad05
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8266
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12304
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/ctf/fs-src/file.cpp
src/plugins/ctf/fs-src/file.hpp

index e3f7d7783c1c872ff5b52b30c40df97ad9a85c43..56c9c451da2b8089591f62d941db73b5282adf60 100644 (file)
@@ -8,27 +8,14 @@
 #include <stdio.h>
 #include <sys/stat.h>
 
+#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<ctf_fs_file>(parentLogger);
 }
 
 int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode)
index 5f0ca39570ec32d3689d8c6438fe4b9cfb236f6c..d367cb505b074f544a93e80d59e339884ff1081b 100644 (file)
 #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<ctf_fs_file, ctf_fs_file_deleter>;
+    using UP = std::unique_ptr<ctf_fs_file>;
 
     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);
This page took 0.026634 seconds and 4 git commands to generate.