diff --git a/src/opustags.h b/src/opustags.h index 93c323b..320aa23 100644 --- a/src/opustags.h +++ b/src/opustags.h @@ -119,13 +119,16 @@ using byte_string_view = std::basic_string_view; * \{ */ +/** fclose wrapper for std::unique_ptr’s deleter. */ +void close_file(FILE*); + /** * Smart auto-closing FILE* handle. * * It implictly converts from an already opened FILE*. */ -struct file : std::unique_ptr { - file(FILE* f = nullptr) : std::unique_ptr(f, &fclose) {} +struct file : std::unique_ptr { + file(FILE* f = nullptr) : std::unique_ptr(f, &close_file) {} }; /** diff --git a/src/system.cc b/src/system.cc index a93acd3..b04cb9e 100644 --- a/src/system.cc +++ b/src/system.cc @@ -29,6 +29,11 @@ ot::byte_string_view operator""_bsv(const char* data, size_t size) return ot::byte_string_view(reinterpret_cast(data), size); } +void ot::close_file(FILE* file) +{ + fclose(file); +} + void ot::partial_file::open(const char* destination) { final_name = destination;