src.ctf.fs: remove ctf_fs_destroy
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Dec 2023 04:11:57 +0000 (04:11 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
Remove it, since a ctf_fs_destroy instance can simply be deleted.

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

index f2582a82ffab3a74e19c5309edd347fff49ef321..b1ac21d1e47e067576691c1199f5f945d2adb09e 100644 (file)
@@ -296,29 +296,15 @@ void ctf_fs_trace_deleter::operator()(ctf_fs_trace * const trace) noexcept
     ctf_fs_trace_destroy(trace);
 }
 
-void ctf_fs_destroy(struct ctf_fs_component *ctf_fs)
-{
-    if (!ctf_fs) {
-        return;
-    }
-
-    delete ctf_fs;
-}
-
-void ctf_fs_component_deleter::operator()(ctf_fs_component *comp)
-{
-    ctf_fs_destroy(comp);
-}
-
 ctf_fs_component::UP ctf_fs_component_create(const bt2c::Logger& parentLogger)
 {
-    return ctf_fs_component::UP {new ctf_fs_component {parentLogger}};
+    return bt2s::make_unique<ctf_fs_component>(parentLogger);
 }
 
 void ctf_fs_finalize(bt_self_component_source *component)
 {
-    ctf_fs_destroy((struct ctf_fs_component *) bt_self_component_get_data(
-        bt_self_component_source_as_self_component(component)));
+    ctf_fs_component::UP {static_cast<ctf_fs_component *>(
+        bt_self_component_get_data(bt_self_component_source_as_self_component(component)))};
 }
 
 bt2c::GCharUP ctf_fs_make_port_name(struct ctf_fs_ds_file_group *ds_file_group)
index 530f0fb386cac48f9dc357e5b8ff22e4ea83e071..87d649a2b810c2dc93f9e43cfb726dc93062a9ae 100644 (file)
@@ -81,14 +81,9 @@ struct ctf_fs_port_data
     struct ctf_fs_component *ctf_fs = nullptr;
 };
 
-struct ctf_fs_component_deleter
-{
-    void operator()(ctf_fs_component *);
-};
-
 struct ctf_fs_component
 {
-    using UP = std::unique_ptr<ctf_fs_component, ctf_fs_component_deleter>;
+    using UP = std::unique_ptr<ctf_fs_component>;
 
     explicit ctf_fs_component(const bt2c::Logger& parentLogger) noexcept :
         logger {parentLogger, "PLUGIN/SRC.CTF.FS/COMP"}
@@ -181,10 +176,6 @@ int ctf_fs_component_create_ctf_fs_trace(struct ctf_fs_component *ctf_fs,
                                          const bt_value *trace_name_value,
                                          bt_self_component *selfComp);
 
-/* Free `ctf_fs` and everything it owns. */
-
-void ctf_fs_destroy(struct ctf_fs_component *ctf_fs);
-
 /*
  * Read and validate parameters taken by the src.ctf.fs plugin.
  *
This page took 0.026201 seconds and 4 git commands to generate.