| 28 | bool cleanup = true; |
| 29 | |
| 30 | class auto_fclose |
| 31 | { |
| 32 | private: |
| 33 | std::FILE* m_file; |
| 34 | |
| 35 | public: |
| 36 | auto_fclose() noexcept : m_file(nullptr) {} |
| 37 | explicit auto_fclose(std::FILE* file) noexcept : m_file(file) {} |
| 38 | ~auto_fclose() noexcept |
| 39 | { |
| 40 | if (m_file) |
| 41 | std::fclose(m_file); |
| 42 | } |
| 43 | |
| 44 | std::FILE* get() const noexcept { return m_file; } |
| 45 | |
| 46 | auto_fclose(auto_fclose const&) = delete; |
| 47 | auto_fclose& operator=(auto_fclose const&) = delete; |
| 48 | }; |
| 49 | |
| 50 | void test(fs::path const& p) |
| 51 | { |
nothing calls this directly
no outgoing calls
no test coverage detected