[vte] spawn: Use unique_ptr for child setup data
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] spawn: Use unique_ptr for child setup data
- Date: Sun, 3 May 2020 20:18:30 +0000 (UTC)
commit 0c95c0c9f376aa0a2b91c516a52181bbc9f372f5
Author: Christian Persch <chpe src gnome org>
Date: Sun May 3 22:18:11 2020 +0200
spawn: Use unique_ptr for child setup data
src/spawn.hh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/spawn.hh b/src/spawn.hh
index 0a2a5e58..3e12af3b 100644
--- a/src/spawn.hh
+++ b/src/spawn.hh
@@ -53,8 +53,8 @@ private:
// allocations
std::vector<std::pair<int,int>> m_fd_map{{-1, 0}, {-1, 1}, {-1, 2}};
- child_setup_type m_child_setup{(void(*)(void*))0};
- std::shared_ptr<void> m_child_setup_data{nullptr};
+ child_setup_type m_child_setup{nullptr};
+ std::unique_ptr<void, void(*)(void*)> m_child_setup_data{nullptr, nullptr};
bool m_inherit_environ{true};
bool m_systemd_scope{true};
@@ -116,9 +116,9 @@ public:
{
m_child_setup = func;
if (destroy)
- m_child_setup_data = std::shared_ptr<void>(data, destroy);
+ m_child_setup_data = {data, destroy};
else
- m_child_setup_data = std::shared_ptr<void>(data, [](auto p) { });
+ m_child_setup_data = {data, [](auto ptr){}};
}
void add_fds(int const* fds,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]