Commit | Line | Data |
---|---|---|
de719a10 SM |
1 | /* |
2 | * Copyright (c) 2022 EfficiOS, inc. | |
3 | * | |
4 | * SPDX-License-Identifier: MIT | |
5 | */ | |
6 | ||
7 | #ifndef BABELTRACE_CPP_COMMON_GLIB_UP_HPP | |
8 | #define BABELTRACE_CPP_COMMON_GLIB_UP_HPP | |
9 | ||
10 | #include <glib.h> | |
11 | #include <memory> | |
12 | ||
13 | namespace bt2_common { | |
14 | namespace internal { | |
15 | ||
16 | struct GCharDeleter final | |
17 | { | |
18 | void operator()(gchar * const p) noexcept | |
19 | { | |
20 | g_free(p); | |
21 | } | |
22 | }; | |
23 | ||
24 | } /* namespace internal */ | |
25 | ||
26 | using GCharUP = std::unique_ptr<gchar, internal::GCharDeleter>; | |
27 | ||
28 | } /* namespace bt2_common */ | |
29 | ||
30 | #endif /* BABELTRACE_CPP_COMMON_GLIB_UP_HPP */ |