sink.ctf.fs: initialize structure fields
[babeltrace.git] / src / plugins / ctf / fs-sink / fs-sink.cpp
index e99f130d9b4ecf78b75ab53a82cdc88089d39646..39d4ff43848a0d7e2d9ddd3c94f0b66730e8bc3f 100644 (file)
@@ -4,25 +4,26 @@
  * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
  */
 
+#include <glib.h>
+#include <stdio.h>
+
+#include <babeltrace2/babeltrace.h>
+
 #define BT_COMP_LOG_SELF_COMP (fs_sink->self_comp)
 #define BT_LOG_OUTPUT_LEVEL   (fs_sink->log_level)
 #define BT_LOG_TAG            "PLUGIN/SINK.CTF.FS"
 #include "logging/comp-logging.h"
 
-#include <babeltrace2/babeltrace.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <glib.h>
 #include "common/assert.h"
 #include "ctfser/ctfser.h"
+
 #include "plugins/common/param-validation/param-validation.h"
 
-#include "fs-sink.hpp"
-#include "fs-sink-trace.hpp"
-#include "fs-sink-stream.hpp"
 #include "fs-sink-ctf-meta.hpp"
+#include "fs-sink-stream.hpp"
+#include "fs-sink-trace.hpp"
+#include "fs-sink.hpp"
 #include "translate-trace-ir-to-ctf-ir.hpp"
-#include "translate-ctf-ir-to-tsdl.hpp"
 
 static const char * const in_port_name = "in";
 
@@ -125,7 +126,7 @@ static void destroy_fs_sink_comp(struct fs_sink_comp *fs_sink)
     }
 
     BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(fs_sink->upstream_iter);
-    g_free(fs_sink);
+    delete fs_sink;
 
 end:
     return;
@@ -142,16 +143,7 @@ bt_component_class_initialize_method_status ctf_fs_sink_init(bt_self_component_s
     bt_logging_level log_level =
         bt_component_get_logging_level(bt_self_component_as_component(self_comp));
 
-    fs_sink = g_new0(struct fs_sink_comp, 1);
-    if (!fs_sink) {
-        BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, log_level, self_comp,
-                            "Failed to allocate one CTF FS sink structure.");
-        BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(
-            self_comp, "Failed to allocate one CTF FS sink structure.");
-        status = BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR;
-        goto end;
-    }
-
+    fs_sink = new fs_sink_comp;
     fs_sink->log_level = log_level;
     fs_sink->self_comp = self_comp;
     fs_sink->output_dir_path = g_string_new(NULL);
This page took 0.024015 seconds and 4 git commands to generate.