Remove redundant branches
This commit is contained in:
parent
99fab07efa
commit
8023e09712
@ -260,8 +260,7 @@ struct walker final : public file_walker {
|
||||
|
||||
export namespace oar {
|
||||
struct archive : public fs {
|
||||
archive(fs * backing_fs, path const & archive_path) {
|
||||
this->backing_fs = backing_fs;
|
||||
archive(fs & backing_fs, path const & archive_path) : backing_fs{backing_fs} {
|
||||
this->archive_path = archive_path;
|
||||
}
|
||||
|
||||
@ -269,7 +268,7 @@ export namespace oar {
|
||||
* See [fs::walk_files].
|
||||
*/
|
||||
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};
|
||||
|
||||
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].
|
||||
*/
|
||||
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};
|
||||
|
||||
if (archive_entry.find(entry_kind::file, file_path) != entry::find_result::ok) return;
|
||||
@ -296,7 +293,7 @@ export namespace oar {
|
||||
}
|
||||
|
||||
private:
|
||||
fs * backing_fs;
|
||||
fs & backing_fs;
|
||||
|
||||
path archive_path;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user