From 70ff2908167db12ddfb319e5e3dcfcf50ecb886d Mon Sep 17 00:00:00 2001 From: _ov4 Date: Mon, 12 Oct 2026 11:34:54 +0800 Subject: adapt RAII unix file --- include/util/file.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/util') diff --git a/include/util/file.h b/include/util/file.h index bbc6539..fb92a9e 100644 --- a/include/util/file.h +++ b/include/util/file.h @@ -14,6 +14,10 @@ class T_unix_file_d; class T_unix_file_p; +/* + * RAII unix file descriptor + * fd is automatically closed with RAII + */ class T_unix_file_d { public: @@ -51,6 +55,11 @@ public: T_unix_file_d &operator=(const T_unix_file_d &) = delete; }; + +/* + * RAII FILE pointer + * FILE* is automatically closed with RAII + */ class T_unix_file_p : public T_unix_file_d { public: -- cgit v1.3.1-4-g156e