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>
#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)
#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"}
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);