ctf: allocate some structures with new
[babeltrace.git] / src / plugins / ctf / fs-src / file.cpp
index 947e09ddc283b6391c1d4e652beb809ef638c490..5184de45c4a218951b7e7fa967d213d23b2788c2 100644 (file)
@@ -7,8 +7,6 @@
 #include <glib.h>
 #include <stdio.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
 
 #define BT_COMP_LOG_SELF_COMP (file->self_comp)
 #define BT_LOG_OUTPUT_LEVEL   (file->log_level)
@@ -16,6 +14,7 @@
 #include "logging/comp-logging.h"
 
 #include "file.hpp"
+#include "fs.hpp"
 
 void ctf_fs_file_destroy(struct ctf_fs_file *file)
 {
@@ -36,17 +35,12 @@ void ctf_fs_file_destroy(struct ctf_fs_file *file)
         g_string_free(file->path, TRUE);
     }
 
-    g_free(file);
+    delete file;
 }
 
 struct ctf_fs_file *ctf_fs_file_create(bt_logging_level log_level, bt_self_component *self_comp)
 {
-    struct ctf_fs_file *file = g_new0(struct ctf_fs_file, 1);
-
-    if (!file) {
-        goto error;
-    }
-
+    ctf_fs_file *file = new ctf_fs_file;
     file->log_level = log_level;
     file->self_comp = self_comp;
     file->path = g_string_new(NULL);
This page took 0.026178 seconds and 4 git commands to generate.