From 2478aa4b52528d04d71bfb48b286c02817d24ceb Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 9 Jun 2022 15:49:39 -0400 Subject: [PATCH] src.ctf.fs: add GMappedFileUP Add GMappedFileUP, a unique_ptr type used to manage the lifetime of a GMappedFile object. Change-Id: Ibc47d3c6e052499013cb34782b112ff1e72eab46 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/8311 Reviewed-by: Philippe Proulx Reviewed-on: https://review.lttng.org/c/babeltrace/+/10846 Tested-by: jenkins CI-Build: Philippe Proulx --- src/cpp-common/glib-up.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/cpp-common/glib-up.hpp b/src/cpp-common/glib-up.hpp index 5489ac75..e030f883 100644 --- a/src/cpp-common/glib-up.hpp +++ b/src/cpp-common/glib-up.hpp @@ -53,6 +53,20 @@ struct GDirDeleter final using GDirUP = std::unique_ptr; +namespace internal { + +struct GMappedFileDeleter final +{ + void operator()(GMappedFile * const f) + { + g_mapped_file_unref(f); + } +}; + +} /* namespace internal */ + +using GMappedFileUP = std::unique_ptr; + } /* namespace bt2_common */ #endif /* BABELTRACE_CPP_COMMON_GLIB_UP_HPP */ -- 2.34.1