Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame^] | 1 | #ifndef ANDROID_DVR_PERFORMANCED_UNIQUE_FILE_H_ |
| 2 | #define ANDROID_DVR_PERFORMANCED_UNIQUE_FILE_H_ |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | #include <memory> |
| 7 | |
| 8 | namespace android { |
| 9 | namespace dvr { |
| 10 | |
| 11 | // Utility to manage the lifetime of a file pointer. |
| 12 | struct FileDeleter { |
| 13 | void operator()(FILE* fp) { fclose(fp); } |
| 14 | }; |
| 15 | using UniqueFile = std::unique_ptr<FILE, FileDeleter>; |
| 16 | |
| 17 | } // namespace dvr |
| 18 | } // namespace android |
| 19 | |
| 20 | #endif // ANDROID_DVR_PERFORMANCED_UNIQUE_FILE_H_ |