summaryrefslogtreecommitdiff
path: root/src/fileio_func.h
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-05-17 23:32:10 +0200
committerMichael Lutz <michi@icosahedron.de>2020-05-21 20:02:34 +0200
commitc972a63c8cbee7fa8d6d5af2cbbecb8c75ee561a (patch)
tree70d5b6c477666170f07469ba769adc4ec629a91c /src/fileio_func.h
parent37bc2f806462b3c2a84891b3aad6db00e935da86 (diff)
downloadopenttd-c972a63c8cbee7fa8d6d5af2cbbecb8c75ee561a.tar.xz
Codechange: Store info about the dedicated server log file in globals with automatic destruction to simplify control flow in openttd_main.
Diffstat (limited to 'src/fileio_func.h')
-rw-r--r--src/fileio_func.h8
1 files changed, 8 insertions, 0 deletions
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 */