Commit | Line | Data |
---|---|---|
23ed167e SM |
1 | /* |
2 | * Copyright (c) 2022 EfficiOS, inc. | |
3 | * | |
4 | * SPDX-License-Identifier: MIT | |
5 | */ | |
6 | ||
7 | #ifndef BABELTRACE_CPP_COMMON_LIBC_UP_HPP | |
8 | #define BABELTRACE_CPP_COMMON_LIBC_UP_HPP | |
9 | ||
10 | #include <cstdio> | |
11 | #include <memory> | |
12 | ||
13 | namespace bt2_common { | |
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 | ||
28 | } /* namespace bt2_common */ | |
29 | ||
30 | #endif /* BABELTRACE_CPP_COMMON_LIBC_UP_HPP */ |