From c972a63c8cbee7fa8d6d5af2cbbecb8c75ee561a Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Sun, 17 May 2020 23:32:10 +0200 Subject: Codechange: Store info about the dedicated server log file in globals with automatic destruction to simplify control flow in openttd_main. --- src/fileio_func.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/fileio_func.h') diff --git a/src/fileio_func.h b/src/fileio_func.h index dec193193..d95131880 100644 --- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -159,4 +159,12 @@ public: } }; +/** Helper to manage a FILE with a \c std::unique_ptr. */ +struct FileDeleter { + void operator()(FILE *f) + { + if (f) fclose(f); + } +}; + #endif /* FILEIO_FUNC_H */ -- cgit v1.2.3-54-g00ecf