forked from OctaForge/libostd
directory entries are for one-time read only, remove assign/clear
This commit is contained in:
parent
83dc828a89
commit
4c0c4e8f41
12
ostd/path.hh
12
ostd/path.hh
|
@ -907,18 +907,6 @@ struct directory_entry {
|
|||
return p_path;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
p_path.clear();
|
||||
}
|
||||
|
||||
void assign(ostd::path const &p) {
|
||||
p_path = p;
|
||||
}
|
||||
|
||||
void assign(ostd::path &&p) {
|
||||
p_path = std::move(p);
|
||||
}
|
||||
|
||||
private:
|
||||
ostd::path p_path{};
|
||||
};
|
||||
|
|
|
@ -102,7 +102,7 @@ static void dir_read_next(DIR *dh, directory_entry &cur, path const &base) {
|
|||
abort();
|
||||
}
|
||||
if (!o) {
|
||||
cur.clear();
|
||||
cur = directory_entry{};
|
||||
return;
|
||||
}
|
||||
string_range nm{static_cast<char const *>(o->d_name)};
|
||||
|
@ -111,7 +111,7 @@ static void dir_read_next(DIR *dh, directory_entry &cur, path const &base) {
|
|||
}
|
||||
path p{base};
|
||||
p.append(nm);
|
||||
cur.assign(std::move(p));
|
||||
cur = std::move(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ OSTD_EXPORT void rdir_range_impl::read_next() {
|
|||
p_dir.remove_name();
|
||||
dir_read_next(static_cast<DIR *>(p_handles.top()), p_current, p_dir);
|
||||
} else {
|
||||
p_current.clear();
|
||||
p_current = directory_entry{};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue