Commit f7373fce by Jonathan Wakely Committed by Jonathan Wakely

Avoid redundant calls to filesystem::status_known

	* include/bits/fs_ops.h (exists(const path&, error_code&))): Only
	check status_known once.
	* include/experimental/bits/fs_ops.h: Likewise.

From-SVN: r256243
parent c54af068
2018-01-04 Jonathan Wakely <jwakely@redhat.com> 2018-01-04 Jonathan Wakely <jwakely@redhat.com>
* include/bits/fs_ops.h (exists(const path&, error_code&))): Only
check status_known once.
* include/experimental/bits/fs_ops.h: Likewise.
PR libstdc++/83607 PR libstdc++/83607
* include/std/functional (__is_byte_like): New trait. * include/std/functional (__is_byte_like): New trait.
(__is_std_equal_to): Remove. (__is_std_equal_to): Remove.
......
...@@ -125,8 +125,11 @@ namespace filesystem ...@@ -125,8 +125,11 @@ namespace filesystem
{ {
auto __s = status(__p, __ec); auto __s = status(__p, __ec);
if (status_known(__s)) if (status_known(__s))
__ec.clear(); {
return exists(__s); __ec.clear();
return __s.type() != file_type::not_found;
}
return false;
} }
uintmax_t file_size(const path& __p); uintmax_t file_size(const path& __p);
......
...@@ -131,8 +131,11 @@ inline namespace v1 ...@@ -131,8 +131,11 @@ inline namespace v1
{ {
auto __s = status(__p, __ec); auto __s = status(__p, __ec);
if (status_known(__s)) if (status_known(__s))
__ec.clear(); {
return exists(__s); __ec.clear();
return __s.type() != file_type::not_found;
}
return false;
} }
uintmax_t file_size(const path& __p); uintmax_t file_size(const path& __p);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment