PR libstdc++/83626 simplify filesystem::remove and filesystem::remove_all
PR libstdc++/83626 * src/filesystem/ops.cc (remove(const path&, error_code&)): Remove unnecessary symlink_status call. (remove_all(const path&, error_code&)): Use filesystem::remove. * src/filesystem/std-ops.cc: Likewise. From-SVN: r256301
This commit is contained in:
parent
2526c53acf
commit
4ca07db039
@ -1,5 +1,11 @@
|
||||
2018-01-05 Jonathan Wakely <jwakely@redhat.com>
|
||||
|
||||
PR libstdc++/83626
|
||||
* src/filesystem/ops.cc (remove(const path&, error_code&)): Remove
|
||||
unnecessary symlink_status call.
|
||||
(remove_all(const path&, error_code&)): Use filesystem::remove.
|
||||
* src/filesystem/std-ops.cc: Likewise.
|
||||
|
||||
PR libstdc++/83279
|
||||
* src/filesystem/std-ops.cc (do_copy_file): Use non-null offset with
|
||||
sendfile.
|
||||
|
@ -1017,14 +1017,6 @@ fs::remove(const path& p)
|
||||
bool
|
||||
fs::remove(const path& p, error_code& ec) noexcept
|
||||
{
|
||||
const auto s = symlink_status(p, ec);
|
||||
if (!status_known(s))
|
||||
return false;
|
||||
if (s.type() == file_type::not_found)
|
||||
{
|
||||
ec.clear();
|
||||
return false; // Nothing to do, not an error.
|
||||
}
|
||||
if (::remove(p.c_str()) == 0)
|
||||
{
|
||||
ec.clear();
|
||||
@ -1070,14 +1062,9 @@ fs::remove_all(const path& p, error_code& ec) noexcept
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (::remove(p.c_str()) == 0)
|
||||
if (fs::remove(p, ec))
|
||||
++count;
|
||||
else if (errno != ENOENT)
|
||||
{
|
||||
ec.assign(errno, std::generic_category());
|
||||
return -1;
|
||||
}
|
||||
return count;
|
||||
return ec ? -1 : count;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1254,7 +1254,7 @@ bool
|
||||
fs::remove(const path& p)
|
||||
{
|
||||
error_code ec;
|
||||
bool result = fs::remove(p, ec);
|
||||
const bool result = fs::remove(p, ec);
|
||||
if (ec)
|
||||
_GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot remove", p, ec));
|
||||
return result;
|
||||
@ -1263,14 +1263,6 @@ fs::remove(const path& p)
|
||||
bool
|
||||
fs::remove(const path& p, error_code& ec) noexcept
|
||||
{
|
||||
const auto s = symlink_status(p, ec);
|
||||
if (!status_known(s))
|
||||
return false;
|
||||
if (s.type() == file_type::not_found)
|
||||
{
|
||||
ec.clear();
|
||||
return false; // Nothing to do, not an error.
|
||||
}
|
||||
if (::remove(p.c_str()) == 0)
|
||||
{
|
||||
ec.clear();
|
||||
@ -1316,14 +1308,9 @@ fs::remove_all(const path& p, error_code& ec)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (::remove(p.c_str()) == 0)
|
||||
if (fs::remove(p, ec))
|
||||
++count;
|
||||
else if (errno != ENOENT)
|
||||
{
|
||||
ec.assign(errno, std::generic_category());
|
||||
return -1;
|
||||
}
|
||||
return count;
|
||||
return ec ? -1 : count;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user