/* Check if that file is already the one mapped. */
if (!data->file || data->file->file->path != index_entry->path) {
/* Destroy the previously used file. */
- ctf_fs_ds_file_destroy(data->file);
+ delete data->file;
/* Create the new file. */
data->file =
goto end;
}
- ctf_fs_ds_file_destroy(data->file);
+ delete data->file;
delete data;
error:
/* Do not touch "borrowed" file. */
- ctf_fs_ds_file_destroy(ds_file);
+ delete ds_file;
ds_file = NULL;
end:
return bt2s::make_unique<ctf_fs_ds_index>();
}
-void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *ds_file)
+ctf_fs_ds_file::~ctf_fs_ds_file()
{
- if (!ds_file) {
- return;
- }
-
- (void) ds_file_munmap(ds_file);
-
- delete ds_file;
+ (void) ds_file_munmap(this);
}
ctf_fs_ds_file_info::UP ctf_fs_ds_file_info_create(const char *path, int64_t begin_ns)