}
/* Create file on remote host, write it and close it */
- auto* fd = new File(fullpath, dst_host, nullptr);
+ File fd(fullpath, dst_host, nullptr);
if (local_storage_) {
- sg_size_t write_size = fd->local_storage_->write(read_size);
- fd->local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
- (*(fd->local_storage_->extension<FileSystemStorageExt>()->get_content()))[path_] = size_;
+ sg_size_t write_size = fd.local_storage_->write(read_size);
+ fd.local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
+ (*(fd.local_storage_->extension<FileSystemStorageExt>()->get_content()))[path_] = size_;
}
if (local_disk_)
- fd->write(read_size);
- delete fd;
+ fd.write(read_size);
return 0;
}
auto* parse_content = new std::map<std::string, sg_size_t>();
- std::ifstream* fs = surf_ifsopen(filename);
+ auto fs = std::unique_ptr<std::ifstream>(surf_ifsopen(filename));
xbt_assert(not fs->fail(), "Cannot open file '%s' (path=%s)", filename.c_str(),
(boost::join(surf_path, ":")).c_str());
parse_content->insert({tokens.front(), size});
}
} while (not fs->eof());
- delete fs;
return parse_content;
}
auto* parse_content = new std::map<std::string, sg_size_t>();
- std::ifstream* fs = surf_ifsopen(filename);
+ auto fs = std::unique_ptr<std::ifstream>(surf_ifsopen(filename));
xbt_assert(not fs->fail(), "Cannot open file '%s' (path=%s)", filename.c_str(),
(boost::join(surf_path, ":")).c_str());
parse_content->insert({tokens.front(), size});
}
} while (not fs->eof());
- delete fs;
return parse_content;
}
simgrid::s4u::Host* remote_host = simgrid::s4u::Host::by_name_or_null(tokens[2]);
xbt_assert(remote_host, "You're trying to access a host that does not exist. Please check your platform file");
- simgrid::s4u::Disk* disk = nullptr;
+ const simgrid::s4u::Disk* disk = nullptr;
for (auto const& d : remote_host->get_disks())
if (d->get_name() == tokens[1]) {
disk = d;