Commit | Line | Data |
---|---|---|
23ed167e SM |
1 | /* |
2 | * Copyright (c) 2022 EfficiOS, inc. | |
3 | * | |
4 | * SPDX-License-Identifier: MIT | |
5 | */ | |
6 | ||
094bf3f2 SM |
7 | #ifndef BABELTRACE_CPP_COMMON_BT2C_LIBC_UP_HPP |
8 | #define BABELTRACE_CPP_COMMON_BT2C_LIBC_UP_HPP | |
23ed167e SM |
9 | |
10 | #include <cstdio> | |
11 | #include <memory> | |
12 | ||
094bf3f2 | 13 | namespace bt2c { |
23ed167e SM |
14 | namespace internal { |
15 | ||
16 | struct FileCloserDeleter | |
17 | { | |
18 | void operator()(std::FILE * const f) noexcept | |
19 | { | |
20 | std::fclose(f); | |
21 | } | |
22 | }; | |
23 | ||
24 | } /* namespace internal */ | |
25 | ||
26 | using FileUP = std::unique_ptr<std::FILE, internal::FileCloserDeleter>; | |
27 | ||
094bf3f2 | 28 | } /* namespace bt2c */ |
23ed167e | 29 | |
094bf3f2 | 30 | #endif /* BABELTRACE_CPP_COMMON_BT2C_LIBC_UP_HPP */ |