Remove redundant branches

This commit is contained in:
kayomn 2023-02-28 14:14:47 +00:00
parent 99fab07efa
commit 8023e09712

View File

@ -260,8 +260,7 @@ struct walker final : public file_walker {
export namespace oar { export namespace oar {
struct archive : public fs { struct archive : public fs {
archive(fs * backing_fs, path const & archive_path) { archive(fs & backing_fs, path const & archive_path) : backing_fs{backing_fs} {
this->backing_fs = backing_fs;
this->archive_path = archive_path; this->archive_path = archive_path;
} }
@ -269,7 +268,7 @@ export namespace oar {
* See [fs::walk_files]. * See [fs::walk_files].
*/ */
void walk_files(path const & target_path, closure<void(file_walker &)> const & then) override { void walk_files(path const & target_path, closure<void(file_walker &)> const & then) override {
this->backing_fs->read_file(this->archive_path, [&](file_reader & archive_reader) { this->backing_fs.read_file(this->archive_path, [&](file_reader & archive_reader) {
entry archive_entry{&archive_reader}; entry archive_entry{&archive_reader};
if (archive_entry.find(entry_kind::directory, target_path) != entry::find_result::ok) return; if (archive_entry.find(entry_kind::directory, target_path) != entry::find_result::ok) return;
@ -284,9 +283,7 @@ export namespace oar {
* See [fs::read_file]. * See [fs::read_file].
*/ */
void read_file(path const & file_path, closure<void(file_reader &)> const & then) override { void read_file(path const & file_path, closure<void(file_reader &)> const & then) override {
if ((this->backing_fs == nullptr) || (this->archive_path.byte_size() == 0)) return; this->backing_fs.read_file(this->archive_path, [&](file_reader & archive_reader) {
this->backing_fs->read_file(this->archive_path, [&](file_reader & archive_reader) {
entry archive_entry {&archive_reader}; entry archive_entry {&archive_reader};
if (archive_entry.find(entry_kind::file, file_path) != entry::find_result::ok) return; if (archive_entry.find(entry_kind::file, file_path) != entry::find_result::ok) return;
@ -296,7 +293,7 @@ export namespace oar {
} }
private: private:
fs * backing_fs; fs & backing_fs;
path archive_path; path archive_path;
}; };