Move create_unique_class util to the memory namespace
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 21 Apr 2023 18:48:53 +0000 (14:48 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 26 Apr 2023 17:55:24 +0000 (13:55 -0400)
create_unique_class is helpful to write unique_ptr wrappers and is now
accessed in numerous places even though it lives in the `details`
namespace.

Moving it to the `memory` namespace to live with other memory management
facilities.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id4bb5100c1eb3a7e1e2d65f5b2d40ff8f97c786e

include/lttng/notification/channel-internal.hpp
include/lttng/notification/notification-internal.hpp
src/bin/lttng-sessiond/rotation-thread.cpp
src/bin/lttng-sessiond/session.hpp
src/bin/lttng-sessiond/ust-registry-session.hpp
src/bin/lttng/commands/destroy.cpp
src/bin/lttng/utils.hpp
src/common/make-unique-wrapper.hpp
src/common/pipe.hpp

index 34014f16ffbc652e6ac91e5cead59cff506c554d..173b3dcdc3333c873c645b66d098c71565cfa000 100644 (file)
@@ -87,7 +87,7 @@ struct pending_notification {
 struct lttng_notification_channel {
        using uptr = std::unique_ptr<
                lttng_notification_channel,
-               lttng::details::create_unique_class<lttng_notification_channel,
+               lttng::memory::create_deleter_class<lttng_notification_channel,
                                                    lttng_notification_channel_destroy>::deleter>;
 
        pthread_mutex_t lock;
index 9fe471c2631fbadeab1ab3c00c61e7d2ce4b8b72..36b3d7f3839ba6cd06ea0974324a84d2a51cefbc 100644 (file)
@@ -24,7 +24,7 @@ struct lttng_payload_view;
 struct lttng_notification {
        using uptr = std::unique_ptr<
                lttng_notification,
-               lttng::details::create_unique_class<lttng_notification,
+               lttng::memory::create_deleter_class<lttng_notification,
                                                    lttng_notification_destroy>::deleter>;
 
        struct lttng_trigger *trigger;
index 9c92f66abaa1a7d1cb30aaff9f9f59ca845e46b1..10afaa649770139abd7d359fcb37c7114f79d0bf 100644 (file)
@@ -70,7 +70,7 @@ namespace {
 struct rotation_thread_job {
        using uptr = std::unique_ptr<
                rotation_thread_job,
-               lttng::details::create_unique_class<rotation_thread_job, lttng::free>>;
+               lttng::memory::create_deleter_class<rotation_thread_job, lttng::free>::deleter>;
 
        enum ls::rotation_thread_job_type type;
        struct ltt_session *session;
index 74be7e959ef5311114a43980cf05ead1594de548..8993f94681a27c9b900c93c12a39f542d5f31a5d 100644 (file)
@@ -79,7 +79,7 @@ struct ltt_session {
        using id_t = uint64_t;
        using locked_ptr =
                std::unique_ptr<ltt_session,
-                               lttng::details::create_unique_class<
+                               lttng::memory::create_deleter_class<
                                        ltt_session,
                                        lttng::sessiond::details::locked_session_release>::deleter>;
        using sptr = std::shared_ptr<ltt_session>;
index bfffe5b50c925b4ef53a7dd630accb4fa4799d6a..7f407e13ae6edcab0bbb0fba594589fa5edcdb03 100644 (file)
@@ -39,7 +39,7 @@ class registry_session : public lttng::sessiond::trace::trace_class {
 public:
        using locked_ptr =
                std::unique_ptr<registry_session,
-                               lttng::details::create_unique_class<
+                               lttng::memory::create_deleter_class<
                                        registry_session,
                                        details::locked_registry_session_release>::deleter>;
 
index 97bd1aa60efd325f2cd78d5287f9469433ef747a..b9fd53bbf620bbd7be275c5a0aabf6c24e3387f2 100644 (file)
@@ -110,7 +110,7 @@ cmd_error_code destroy_session(const lttng_session& session)
                } while (ret != 0);
        }
 
-       std::unique_ptr<char, lttng::details::create_unique_class<char, lttng::free>>
+       std::unique_ptr<char, lttng::memory::create_deleter_class<char, lttng::free>::deleter>
                stats_str;
        if (!session_was_already_stopped) {
                char *raw_stats_str = nullptr;
index 4fa15c38d2f26a689e93d34c8896d7e1b8fb8bdc..61fb6f6ffbbf9a1d8003a757b1e242e3f1e97f4a 100644 (file)
@@ -156,7 +156,7 @@ public:
 private:
        std::size_t _sessions_count;
        std::unique_ptr<lttng_session,
-                       lttng::details::create_unique_class<lttng_session, lttng::free>>
+                       lttng::memory::create_deleter_class<lttng_session, lttng::free>::deleter>
                _sessions;
 };
 
index 9381ce9711d2b57a257310bc52217d239995fc13..e49e5ced779e5bc8343b32c8e4f402625555da9a 100644 (file)
@@ -38,9 +38,9 @@ namespace lttng {
  * a proper, idiomatic, wrapper.
  */
 
-namespace details {
+namespace memory {
 template <typename WrappedType, void (*DeleterFunction)(WrappedType *)>
-struct create_unique_class {
+struct create_deleter_class {
        struct deleter {
                void operator()(WrappedType *instance) const
                {
@@ -53,7 +53,7 @@ struct create_unique_class {
                return std::unique_ptr<WrappedType, deleter>(instance);
        }
 };
-} /* namespace details */
+} /* namespace memory */
 
 /*
  * 'free' is a utility function for use with make_unique_wrapper. It makes it easier to
@@ -69,10 +69,10 @@ void free(Type *ptr)
 
 template <typename WrappedType, void (*DeleterFunc)(WrappedType *)>
 std::unique_ptr<WrappedType,
-               typename details::create_unique_class<WrappedType, DeleterFunc>::deleter>
+               typename memory::create_deleter_class<WrappedType, DeleterFunc>::deleter>
 make_unique_wrapper(WrappedType *instance)
 {
-       const details::create_unique_class<WrappedType, DeleterFunc> unique_deleter;
+       const memory::create_deleter_class<WrappedType, DeleterFunc> unique_deleter;
 
        return unique_deleter(instance);
 }
index 7c8cf89b6b9b94e3ab00fce5b337a10e7ac57783..9798a8cf8c794ea191db2fa0445695dc3a4feca0 100644 (file)
@@ -30,7 +30,7 @@ struct lttng_pipe {
 
        using uptr = std::unique_ptr<
                lttng_pipe,
-               lttng::details::create_unique_class<lttng_pipe, _lttng_pipe_close_wrapper>::deleter>;
+               lttng::memory::create_deleter_class<lttng_pipe, _lttng_pipe_close_wrapper>::deleter>;
 
        /* Read: 0, Write: 1. */
        int fd[2];
This page took 0.029586 seconds and 4 git commands to generate.