Move the lttng::free util under the lttng::memory namespace
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 8 Mar 2024 21:17:46 +0000 (16:17 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 12 Mar 2024 03:05:32 +0000 (23:05 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I40bf5aefaa8f441f470c0866b71b2957a6c30154

include/lttng/session-internal.hpp
src/bin/lttng-sessiond/rotation-thread.cpp
src/bin/lttng-sessiond/ust-app.cpp
src/bin/lttng-sessiond/ust-registry-session.cpp
src/bin/lttng/commands/destroy.cpp
src/bin/lttng/commands/enable_events.cpp
src/bin/lttng/utils.cpp
src/common/format.hpp
src/common/make-unique-wrapper.hpp
src/lib/lttng-ctl/lttng-ctl.cpp

index aead01b78137796a349d0ee9757e73b9c0434d0b..61e65981c6e280e74b2789a1f80e2e453cf1de16 100644 (file)
@@ -22,8 +22,8 @@ struct lttng_session_extended {
        } LTTNG_PACKED creation_time;
 } LTTNG_PACKED;
 
-using lttng_session_uptr =
-       std::unique_ptr<lttng_session[],
-                       lttng::memory::create_deleter_class<lttng_session, lttng::free>::deleter>;
+using lttng_session_uptr = std::unique_ptr<
+       lttng_session[],
+       lttng::memory::create_deleter_class<lttng_session, lttng::memory::free>::deleter>;
 
 #endif /* LTTNG_SESSION_INTERNAL_H */
index 1d62c851ee3b57038d35d692363d3998b3f1d4ff..a26b38eebca970230f3a02d8bee8c9fdcba92bc0 100644 (file)
@@ -68,9 +68,10 @@ struct ls::rotation_thread_timer_queue {
 
 namespace {
 struct rotation_thread_job {
-       using uptr = std::unique_ptr<
-               rotation_thread_job,
-               lttng::memory::create_deleter_class<rotation_thread_job, lttng::free>::deleter>;
+       using uptr =
+               std::unique_ptr<rotation_thread_job,
+                               lttng::memory::create_deleter_class<rotation_thread_job,
+                                                                   lttng::memory::free>::deleter>;
 
        enum ls::rotation_thread_job_type type;
        struct ltt_session *session;
index 82430db771b3df6d36499d488f95de3a6211706a..12250edfdaefb1341736ba5b78c62a53ceba1c8e 100644 (file)
@@ -6522,7 +6522,8 @@ static int handle_app_register_channel_notification(int sock,
        struct ust_app_channel *ua_chan;
        struct ust_app_session *ua_sess;
        auto ust_ctl_context_fields =
-               lttng::make_unique_wrapper<lttng_ust_ctl_field, lttng::free>(raw_context_fields);
+               lttng::make_unique_wrapper<lttng_ust_ctl_field, lttng::memory::free>(
+                       raw_context_fields);
 
        lttng::urcu::read_lock_guard read_lock_guard;
 
@@ -6686,9 +6687,11 @@ static int add_event_ust_registry(int sock,
        struct ust_app_channel *ua_chan;
        struct ust_app_session *ua_sess;
        lttng::urcu::read_lock_guard rcu_lock;
-       auto signature = lttng::make_unique_wrapper<char, lttng::free>(raw_signature);
-       auto fields = lttng::make_unique_wrapper<lttng_ust_ctl_field, lttng::free>(raw_fields);
-       auto model_emf_uri = lttng::make_unique_wrapper<char, lttng::free>(raw_model_emf_uri);
+       auto signature = lttng::make_unique_wrapper<char, lttng::memory::free>(raw_signature);
+       auto fields =
+               lttng::make_unique_wrapper<lttng_ust_ctl_field, lttng::memory::free>(raw_fields);
+       auto model_emf_uri =
+               lttng::make_unique_wrapper<char, lttng::memory::free>(raw_model_emf_uri);
 
        /* Lookup application. If not found, there is a code flow error. */
        app = find_app_by_notify_sock(sock);
@@ -6809,8 +6812,9 @@ static int add_enum_ust_registry(int sock,
        struct ust_app_session *ua_sess;
        uint64_t enum_id = -1ULL;
        lttng::urcu::read_lock_guard read_lock_guard;
-       auto entries = lttng::make_unique_wrapper<struct lttng_ust_ctl_enum_entry, lttng::free>(
-               raw_entries);
+       auto entries =
+               lttng::make_unique_wrapper<struct lttng_ust_ctl_enum_entry, lttng::memory::free>(
+                       raw_entries);
 
        /* Lookup application. If not found, there is a code flow error. */
        app = find_app_by_notify_sock(sock);
index 518108cbde4ce97eede2d209c841a35450c56e7c..d0891fe9a87325a3d245e52cbe001c5a2c401c41 100644 (file)
@@ -785,8 +785,8 @@ void lsu::registry_session::create_or_find_enum(int session_objd,
        struct cds_lfht_node *nodep;
        lsu::registry_enum *reg_enum = nullptr, *old_reg_enum;
        lttng::urcu::read_lock_guard read_lock_guard;
-       auto entries =
-               lttng::make_unique_wrapper<lttng_ust_ctl_enum_entry, lttng::free>(raw_entries);
+       auto entries = lttng::make_unique_wrapper<lttng_ust_ctl_enum_entry, lttng::memory::free>(
+               raw_entries);
 
        LTTNG_ASSERT(enum_name);
 
index 0258e31e858ced1d61dfb76a85d916f6932d203c..5e19d4189025181682d2040d503290cc9d0172cf 100644 (file)
@@ -110,7 +110,8 @@ cmd_error_code destroy_session(const lttng_session& session)
                } while (ret != 0);
        }
 
-       std::unique_ptr<char, lttng::memory::create_deleter_class<char, lttng::free>::deleter>
+       std::unique_ptr<char,
+                       lttng::memory::create_deleter_class<char, lttng::memory::free>::deleter>
                stats_str;
        if (!session_was_already_stopped) {
                char *raw_stats_str = nullptr;
@@ -242,7 +243,7 @@ cmd_error_code destroy_session(const lttng_session& session)
         * destroy the file.
         */
        const auto session_name =
-               lttng::make_unique_wrapper<char, lttng::free>(get_session_name_quiet());
+               lttng::make_unique_wrapper<char, lttng::memory::free>(get_session_name_quiet());
        if (session_name && !strncmp(session.name, session_name.get(), NAME_MAX)) {
                config_destroy_default();
        }
index f827c924d9c483ec50143fb9a1172845b7df6710..b081adeeed7f3f68d7d97f57722002091c40bef0 100644 (file)
@@ -717,8 +717,9 @@ int enable_events(const std::string& session_name, const event_rule_patterns& pa
                                lttng_dynamic_pointer_array_get_count(&exclusions),
                                (char **) exclusions.array.buffer.data);
 
-                       auto exclusion_string = lttng::make_unique_wrapper<char, lttng::free>(
-                               print_exclusions(&exclusions));
+                       auto exclusion_string =
+                               lttng::make_unique_wrapper<char, lttng::memory::free>(
+                                       print_exclusions(&exclusions));
                        if (!exclusion_string) {
                                PERROR("Cannot allocate exclusion_string");
                                error = 1;
@@ -820,8 +821,9 @@ int enable_events(const std::string& session_name, const event_rule_patterns& pa
                                lttng_dynamic_pointer_array_get_count(&exclusions),
                                (char **) exclusions.array.buffer.data);
 
-                       auto exclusion_string = lttng::make_unique_wrapper<char, lttng::free>(
-                               print_exclusions(&exclusions));
+                       auto exclusion_string =
+                               lttng::make_unique_wrapper<char, lttng::memory::free>(
+                                       print_exclusions(&exclusions));
                        if (!exclusion_string) {
                                PERROR("Failed allocate exclusion string");
                                error = 1;
@@ -1162,7 +1164,7 @@ int cmd_enable_events(int argc, const char **argv)
 
        if (!opt_session_name) {
                const auto rc_file_session_name =
-                       lttng::make_unique_wrapper<char, lttng::free>(get_session_name());
+                       lttng::make_unique_wrapper<char, lttng::memory::free>(get_session_name());
 
                if (!rc_file_session_name) {
                        return CMD_ERROR;
index 26a0cf5edfe770a5ff891f82713a342e88ae34af..403ee018579f755819877ce5d25109b7f94f24a4 100644 (file)
@@ -712,7 +712,8 @@ lttng::cli::session_list lttng::cli::list_sessions(const struct session_spec& sp
        case lttng::cli::session_spec::type::NAME:
                if (spec.value == nullptr) {
                        const auto configured_name =
-                               lttng::make_unique_wrapper<char, lttng::free>(get_session_name());
+                               lttng::make_unique_wrapper<char, lttng::memory::free>(
+                                       get_session_name());
 
                        if (configured_name) {
                                const struct lttng::cli::session_spec new_spec(
index 07673e7a98166ad9acd5b7d714693be9d3b9b8df..2ba6cef125ab735ae8977c88dde7298c0c889f93 100644 (file)
@@ -36,9 +36,9 @@ struct formatter<std::type_info> : formatter<std::string> {
                int status;
                /*
                 * The documentation of __cxa_demangle mentions the returned string is allocated
-                * using malloc (not new), hence the use of lttng::free.
+                * using malloc (not new), hence the use of lttng::memory::free.
                 */
-               const auto demangled_name = lttng::make_unique_wrapper<char, lttng::free>(
+               const auto demangled_name = lttng::make_unique_wrapper<char, lttng::memory::free>(
                        abi::__cxa_demangle(type_info.name(), nullptr, nullptr, &status));
 
                auto it = status == 0 ? formatter<std::string>::format(demangled_name.get(), ctx) :
index ebec2ca45d29a908a648d398a5a8dfba516afa9f..282181cffa58439b9dd7642949a40701c3b67512 100644 (file)
@@ -53,7 +53,6 @@ struct create_deleter_class {
                return std::unique_ptr<WrappedType, deleter>(instance);
        }
 };
-} /* namespace memory */
 
 /*
  * 'free' is a utility function for use with make_unique_wrapper. It makes it easier to
@@ -66,6 +65,7 @@ void free(Type *ptr)
 {
        std::free(ptr);
 }
+} /* namespace memory */
 
 template <typename WrappedType, void (*DeleterFunc)(WrappedType *)>
 std::unique_ptr<WrappedType,
index 96ed7b41b8abc5f5afc60a6b20de84950c1445ca..bbc94828e6c828e7b7a9acbe90080654d714202a 100644 (file)
@@ -2896,7 +2896,7 @@ enum lttng_error_code lttng_get_kernel_tracer_status(enum lttng_kernel_tracer_st
        const auto ask_ret = lttng_ctl_ask_sessiond(&lsm, (void **) &raw_tracer_status);
 
        const auto tracer_status =
-               lttng::make_unique_wrapper<uint32_t, lttng::free>(raw_tracer_status);
+               lttng::make_unique_wrapper<uint32_t, lttng::memory::free>(raw_tracer_status);
 
        if (ask_ret != 4) {
                return LTTNG_ERR_INVALID;
This page took 0.03499 seconds and 4 git commands to generate.