src.ctf.lttng-live: add lttng_live_session destructor
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 26 Jul 2022 21:42:57 +0000 (17:42 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 16:06:16 +0000 (12:06 -0400)
Convert lttng_live_destroy_session to a destructor.  Add a new
lttng_livelttng_live_destroy_session function that calls delete, it's
still needed for the GPtrArray (which will be removed in a subsequent
patch).

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

index 7ea23e6d0dd5c483088026fc261c6a04fcf8e3ba..4bf0a53011cb28d480064b0137ab46c09e8613c0 100644 (file)
@@ -200,31 +200,25 @@ int lttng_live_add_session(struct lttng_live_msg_iter *lttng_live_msg_iter, uint
     return 0;
 }
 
-static void lttng_live_destroy_session(struct lttng_live_session *session)
+lttng_live_session::~lttng_live_session()
 {
-    const bt2_common::LogCfg& logCfg = session->logCfg;
-
-    if (!session) {
-        goto end;
-    }
-
     BT_CLOGD("Destroying live session: "
              "session-id=%" PRIu64 ", session-name=\"%s\"",
-             session->id, session->session_name.c_str());
-    if (session->id != -1ULL) {
-        if (lttng_live_session_detach(session)) {
-            if (!lttng_live_graph_is_canceled(session->lttng_live_msg_iter)) {
+             this->id, this->session_name.c_str());
+    if (this->id != -1ULL) {
+        if (lttng_live_session_detach(this)) {
+            if (!lttng_live_graph_is_canceled(this->lttng_live_msg_iter)) {
                 /* Old relayd cannot detach sessions. */
-                BT_CLOGD("Unable to detach lttng live session %" PRIu64, session->id);
+                BT_CLOGD("Unable to detach lttng live session %" PRIu64, this->id);
             }
         }
-        session->id = -1ULL;
+        this->id = -1ULL;
     }
+}
 
+static void lttng_live_destroy_session(struct lttng_live_session *session)
+{
     delete session;
-
-end:
-    return;
 }
 
 static void lttng_live_msg_iter_destroy(struct lttng_live_msg_iter *lttng_live_msg_iter)
index e4d2c48d0a285ffbd5d5098d8a398c9e32cecb7d..da70c804d308a322a82b75e533c6535eab16d0b7 100644 (file)
@@ -200,6 +200,8 @@ struct lttng_live_session
     {
     }
 
+    ~lttng_live_session();
+
     const bt2_common::LogCfg logCfg;
 
     bt_self_component *self_comp = nullptr;
This page took 0.02614 seconds and 5 git commands to generate.