blob: 86e487a83a3c8d6c2117cfd5dd11be57d87e9da7 [file] [log] [blame]
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08001#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
8namespace android {
9namespace dvr {
10
11// Utility to manage the lifetime of a file pointer.
12struct FileDeleter {
13 void operator()(FILE* fp) { fclose(fp); }
14};
15using UniqueFile = std::unique_ptr<FILE, FileDeleter>;
16
17} // namespace dvr
18} // namespace android
19
20#endif // ANDROID_DVR_PERFORMANCED_UNIQUE_FILE_H_