projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src.ctf.fs: make ctf_fs_file_create return a unique_ptr
[babeltrace.git]
/
src
/
plugins
/
ctf
/
fs-src
/
file.cpp
diff --git
a/src/plugins/ctf/fs-src/file.cpp
b/src/plugins/ctf/fs-src/file.cpp
index 938c048dee513ce7c56546a8bdfee9465e547b18..d125789e6e6c9ae68424e50a76bb06e034e444eb 100644
(file)
--- a/
src/plugins/ctf/fs-src/file.cpp
+++ b/
src/plugins/ctf/fs-src/file.cpp
@@
-35,9
+35,15
@@
void ctf_fs_file_destroy(struct ctf_fs_file *file)
delete file;
}
delete file;
}
-struct ctf_fs_file *ctf_fs_file_create(const bt2c::Logger& parentLogger)
+void ctf_fs_file_deleter::operator()(ctf_fs_file * const file) noexcept
{
{
- ctf_fs_file *file = new ctf_fs_file {parentLogger};
+ ctf_fs_file_destroy(file);
+}
+
+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;
file->path = g_string_new(NULL);
if (!file->path) {
goto error;
@@
-46,8
+52,7
@@
struct ctf_fs_file *ctf_fs_file_create(const bt2c::Logger& parentLogger)
goto end;
error:
goto end;
error:
- ctf_fs_file_destroy(file);
- file = NULL;
+ file.reset();
end:
return file;
end:
return file;
This page took
0.02331 seconds
and
4
git commands to generate.