X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Ffs-src%2Ffile.cpp;h=e3f7d7783c1c872ff5b52b30c40df97ad9a85c43;hb=a39d981713c02a0c5cc472ce48521d86d69fd2a1;hp=33399d94fbeaee99347d53fb8c12a489c2da46e2;hpb=85a25425dc0e75ed5fc2e38d93ef56fbe7156252;p=babeltrace.git diff --git a/src/plugins/ctf/fs-src/file.cpp b/src/plugins/ctf/fs-src/file.cpp index 33399d94..e3f7d778 100644 --- a/src/plugins/ctf/fs-src/file.cpp +++ b/src/plugins/ctf/fs-src/file.cpp @@ -18,10 +18,6 @@ void ctf_fs_file_destroy(struct ctf_fs_file *file) return; } - if (file->path) { - g_string_free(file->path, TRUE); - } - delete file; } @@ -32,20 +28,7 @@ void ctf_fs_file_deleter::operator()(ctf_fs_file * const file) noexcept ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger) { - ctf_fs_file::UP file {new ctf_fs_file {parentLogger}}; - - file->path = g_string_new(NULL); - if (!file->path) { - goto error; - } - - goto end; - -error: - file.reset(); - -end: - return file; + return ctf_fs_file::UP {new ctf_fs_file {parentLogger}}; } int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode) @@ -53,11 +36,11 @@ int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode) int ret = 0; struct stat stat; - BT_CPPLOGI_SPEC(file->logger, "Opening file \"{}\" with mode \"{}\"", file->path->str, mode); - file->fp.reset(fopen(file->path->str, mode)); + BT_CPPLOGI_SPEC(file->logger, "Opening file \"{}\" with mode \"{}\"", file->path, mode); + file->fp.reset(fopen(file->path.c_str(), mode)); if (!file->fp) { BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(file->logger, "Cannot open file", ": path={}, mode={}", - file->path->str, mode); + file->path, mode); goto error; } @@ -65,7 +48,7 @@ int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode) if (fstat(fileno(file->fp.get()), &stat)) { BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(file->logger, "Cannot get file information", ": path={}", - file->path->str); + file->path); goto error; }