Skip to content

Commit

Permalink
refs #104, performance related refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gulrak committed Feb 22, 2021
1 parent 0e5f2f5 commit 8a19af1
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions include/ghc/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2226,12 +2226,12 @@ GHC_INLINE file_status status_ex(const path& p, std::error_code& ec, file_status
if (result == 0) {
ec.clear();
file_status fs = detail::file_status_from_st_mode(st.st_mode);
if (sls) {
*sls = fs;
}
if (fs.type() == file_type::symlink) {
result = ::stat(p.c_str(), &st);
if (result == 0) {
if (sls) {
*sls = fs;
}
fs = detail::file_status_from_st_mode(st.st_mode);
}
}
Expand Down Expand Up @@ -5487,7 +5487,7 @@ class directory_iterator::impl
if (_entry) {
_current = _base;
_current.append_name(_entry->d_name);
_dir_entry = directory_entry(_current, ec);
_dir_entry.assign(_current, ec);
if (ec && (ec.value() == EACCES || ec.value() == EPERM) && (_options & directory_options::skip_permission_denied) == directory_options::skip_permission_denied) {
ec.clear();
skip = true;
Expand Down Expand Up @@ -5730,13 +5730,7 @@ GHC_INLINE recursive_directory_iterator& recursive_directory_iterator::operator+

GHC_INLINE recursive_directory_iterator& recursive_directory_iterator::increment(std::error_code& ec) noexcept
{
auto status = (*this)->status(ec);
if (ec)
return *this;
auto symlink_status = (*this)->symlink_status(ec);
if (ec)
return *this;
if (recursion_pending() && is_directory(status) && (!is_symlink(symlink_status) || (options() & directory_options::follow_directory_symlink) != directory_options::none)) {
if (recursion_pending() && (*this)->is_directory() && (!(*this)->is_symlink() || (options() & directory_options::follow_directory_symlink) != directory_options::none)) {
_impl->_dir_iter_stack.push(directory_iterator((*this)->path(), _impl->_options, ec));
}
else {
Expand Down

0 comments on commit 8a19af1

Please sign in to comment.