cpp-common: add GCharUP
[babeltrace.git] / src / cpp-common / glib-up.hpp
CommitLineData
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
13namespace bt2_common {
14namespace internal {
15
16struct GCharDeleter final
17{
18 void operator()(gchar * const p) noexcept
19 {
20 g_free(p);
21 }
22};
23
24} /* namespace internal */
25
26using GCharUP = std::unique_ptr<gchar, internal::GCharDeleter>;
27
28} /* namespace bt2_common */
29
30#endif /* BABELTRACE_CPP_COMMON_GLIB_UP_HPP */
This page took 0.0238 seconds and 4 git commands to generate.