io/FileReader: remove unused method Close()
It's enough to have the destructor.
This commit is contained in:
parent
678828b56f
commit
11c49da871
|
@ -61,14 +61,6 @@ FileReader::Skip(off_t offset)
|
|||
throw MakeLastError("Failed to seek");
|
||||
}
|
||||
|
||||
void
|
||||
FileReader::Close() noexcept
|
||||
{
|
||||
assert(IsDefined());
|
||||
|
||||
CloseHandle(handle);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
FileReader::FileReader(Path _path)
|
||||
|
@ -123,12 +115,4 @@ FileReader::Skip(off_t offset)
|
|||
throw MakeErrno("Failed to seek");
|
||||
}
|
||||
|
||||
void
|
||||
FileReader::Close() noexcept
|
||||
{
|
||||
assert(IsDefined());
|
||||
|
||||
fd.Close();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
// author: Max Kellermann <max.kellermann@gmail.com>
|
||||
|
||||
#ifndef FILE_READER_HXX
|
||||
#define FILE_READER_HXX
|
||||
#pragma once
|
||||
|
||||
#include "Reader.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
|
@ -39,8 +38,8 @@ public:
|
|||
handle(std::exchange(other.handle, INVALID_HANDLE_VALUE)) {}
|
||||
|
||||
~FileReader() noexcept {
|
||||
if (IsDefined())
|
||||
Close();
|
||||
if (handle != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(handle);
|
||||
}
|
||||
#else
|
||||
FileReader(FileReader &&other) noexcept
|
||||
|
@ -65,8 +64,6 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
void Close() noexcept;
|
||||
|
||||
FileInfo GetFileInfo() const;
|
||||
|
||||
[[gnu::pure]]
|
||||
|
@ -105,5 +102,3 @@ public:
|
|||
/* virtual methods from class Reader */
|
||||
std::size_t Read(void *data, std::size_t size) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue