diff --git a/include/iocore/net/ConnectionTracker.h b/include/iocore/net/ConnectionTracker.h index d41d9ad86f0..360fda7b640 100644 --- a/include/iocore/net/ConnectionTracker.h +++ b/include/iocore/net/ConnectionTracker.h @@ -32,6 +32,7 @@ #include #include #include +#include #include "records/RecCore.h" #include "tscore/ink_platform.h" #include "tscore/ink_config.h" @@ -429,7 +430,7 @@ ConnectionTracker::Group::metric_name(const Key &key, std::string_view fqdn, std default: Warning("Invalid matching type to add to per_server.connections metrics"); } - return metric_prefix.empty() ? metric_name : metric_prefix + "." + metric_name; + return metric_prefix.empty() ? std::move(metric_name) : metric_prefix + "." + metric_name; } inline bool diff --git a/include/mgmt/config/ConfigReloadTrace.h b/include/mgmt/config/ConfigReloadTrace.h index 1db523e8a7a..b325c707b1f 100644 --- a/include/mgmt/config/ConfigReloadTrace.h +++ b/include/mgmt/config/ConfigReloadTrace.h @@ -25,11 +25,12 @@ #include #include +#include #include #include #include #include -#include +#include #include #include @@ -207,7 +208,7 @@ class ConfigReloadTask : public std::enable_shared_from_this using self_type = ConfigReloadTask; ConfigReloadTask() = default; ConfigReloadTask(std::string_view token, std::string_view description, bool main_task, ConfigReloadTaskPtr parent) - : _info(State::CREATED, token, description, main_task), _parent{parent} + : _info(State::CREATED, token, description, main_task), _parent{std::move(parent)} { if (_info.main_task) { _info.state = State::IN_PROGRESS; diff --git a/plugins/experimental/filter_body/filter_body.cc b/plugins/experimental/filter_body/filter_body.cc index ca7471c71bf..224c78fec01 100644 --- a/plugins/experimental/filter_body/filter_body.cc +++ b/plugins/experimental/filter_body/filter_body.cc @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -901,7 +902,7 @@ parse_config(const char *filename) AddHeader add_hdr; add_hdr.name = hdr.first.as(); add_hdr.value = hdr.second.as(); - rule.add_headers.push_back(add_hdr); + rule.add_headers.push_back(std::move(add_hdr)); } } } @@ -953,7 +954,7 @@ parse_config(const char *filename) cond.patterns.push_back(pattern_node.as()); } } - rule.headers.push_back(cond); + rule.headers.push_back(std::move(cond)); } } diff --git a/plugins/experimental/jax_fingerprint/ja4/test.cc b/plugins/experimental/jax_fingerprint/ja4/test.cc index 35f8e79b53a..16456d19e7c 100644 --- a/plugins/experimental/jax_fingerprint/ja4/test.cc +++ b/plugins/experimental/jax_fingerprint/ja4/test.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include namespace @@ -127,7 +128,7 @@ class MockDatasource : public ja4::Datasource void set_first_alpn(std::string first_alpn) { - this->_first_alpn = first_alpn; + this->_first_alpn = std::move(first_alpn); } void add_cipher(std::uint16_t cipher) diff --git a/plugins/experimental/jax_fingerprint/ja4h/test.cc b/plugins/experimental/jax_fingerprint/ja4h/test.cc index d2f84b1a8ba..3d1abb50224 100644 --- a/plugins/experimental/jax_fingerprint/ja4h/test.cc +++ b/plugins/experimental/jax_fingerprint/ja4h/test.cc @@ -27,6 +27,7 @@ #include #include +#include namespace { @@ -89,7 +90,7 @@ class MockDatasource : public Datasource void set_method(std::string method) { - this->_method = method; + this->_method = std::move(method); } void set_version(int version) @@ -99,7 +100,7 @@ class MockDatasource : public Datasource void set_fields(std::map fields) { - this->_fields = fields; + this->_fields = std::move(fields); } private: diff --git a/plugins/experimental/txn_box/plugin/src/Comparison.cc b/plugins/experimental/txn_box/plugin/src/Comparison.cc index 85013dd98a8..20d85d042e8 100644 --- a/plugins/experimental/txn_box/plugin/src/Comparison.cc +++ b/plugins/experimental/txn_box/plugin/src/Comparison.cc @@ -21,6 +21,7 @@ */ #include +#include #include #include @@ -1391,7 +1392,7 @@ ComboComparison::load(Config &cfg, YAML::Node const &cmp_node, TextView const &k } else if (value_node.IsSequence()) { cmps.reserve(cmp_node.size()); for (auto child : value_node) { - auto errata = self_type::load_case(cfg, cmps, child); + auto errata = self_type::load_case(cfg, cmps, std::move(child)); if (!errata.is_ok()) { errata.note("While parsing {} comparison at {}.", key, cmp_node.Mark()); return errata; diff --git a/plugins/experimental/txn_box/plugin/src/Config.cc b/plugins/experimental/txn_box/plugin/src/Config.cc index 3e5f9dca023..f90b1ee929e 100644 --- a/plugins/experimental/txn_box/plugin/src/Config.cc +++ b/plugins/experimental/txn_box/plugin/src/Config.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -649,7 +650,7 @@ Config::parse_yaml(YAML::Node root, TextView path) if (root.IsSequence()) { for (auto child : root) { - errata.note((this->*drtv_loader)(child)); + errata.note((this->*drtv_loader)(std::move(child))); } if (!errata.is_ok()) { errata.note(R"(While loading list of top level directives for "{}" at {}.)", path, root.Mark()); diff --git a/plugins/experimental/txn_box/plugin/src/ip_space.cc b/plugins/experimental/txn_box/plugin/src/ip_space.cc index 6b472e6356e..bca213af703 100644 --- a/plugins/experimental/txn_box/plugin/src/ip_space.cc +++ b/plugins/experimental/txn_box/plugin/src/ip_space.cc @@ -698,7 +698,7 @@ Do_ip_space_define::load(Config &cfg, CfgStaticData const *, YAML::Node drtv_nod } } else if (cols_node.IsSequence()) { for (auto child : cols_node) { - auto errata = self->define_column(cfg, child); + auto errata = self->define_column(cfg, std::move(child)); if (!errata.is_ok()) { errata.note(R"(While parsing "{}" key at {}.)", COLUMNS_TAG, cols_node.Mark()); return errata; diff --git a/plugins/prefetch/path.cc b/plugins/prefetch/path.cc index a89e16ce522..7f500bab3ce 100644 --- a/plugins/prefetch/path.cc +++ b/plugins/prefetch/path.cc @@ -24,6 +24,7 @@ #include "path.h" #include +#include namespace { @@ -181,7 +182,7 @@ makeSafeRelativeFetchPath(const String ¤tPath, const String &relativePath, return false; } - fetchPath.path = normalizedCandidatePath; + fetchPath.path = std::move(normalizedCandidatePath); if (String::npos != queryStart) { fetchPath.hasQuery = true; fetchPath.query = relativePath.substr(queryStart + 1); diff --git a/plugins/stats_over_http/stats_over_http.cc b/plugins/stats_over_http/stats_over_http.cc index 9afcd61f78e..954e894ffa9 100644 --- a/plugins/stats_over_http/stats_over_http.cc +++ b/plugins/stats_over_http/stats_over_http.cc @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -744,7 +745,7 @@ parse_metric_v2(std::string_view name) } } - return {base_name, labels}; + return {std::move(base_name), std::move(labels)}; } static bool diff --git a/plugins/webp_transform/ImageTransform.cc b/plugins/webp_transform/ImageTransform.cc index e4ebc7f4d7c..530503748c6 100644 --- a/plugins/webp_transform/ImageTransform.cc +++ b/plugins/webp_transform/ImageTransform.cc @@ -434,13 +434,13 @@ class GlobalHookPlugin : public GlobalPlugin if (!content_length_usable) { TSHttpTxnServerRespNoStoreSet(static_cast(transaction.getAtsHandle()), 1); } - transaction.addPlugin(new ImageTransform(transaction, ctype, input_image_type, ImageEncoding::webp)); + transaction.addPlugin(new ImageTransform(transaction, std::move(ctype), input_image_type, ImageEncoding::webp)); } else if (webp_supported == false && transaction_convert_to_jpeg == true) { Dbg(webp_dbg_ctl, "Content type is webp. Converting to jpeg"); if (!content_length_usable) { TSHttpTxnServerRespNoStoreSet(static_cast(transaction.getAtsHandle()), 1); } - transaction.addPlugin(new ImageTransform(transaction, ctype, input_image_type, ImageEncoding::jpeg)); + transaction.addPlugin(new ImageTransform(transaction, std::move(ctype), input_image_type, ImageEncoding::jpeg)); } else { Dbg(webp_dbg_ctl, "Nothing to convert"); } diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc index 6d085befbb4..8858e90a4c3 100644 --- a/src/api/InkAPI.cc +++ b/src/api/InkAPI.cc @@ -22,11 +22,12 @@ */ #include +#include #include #include #include #include -#include +#include #include "iocore/net/NetVConnection.h" #include "iocore/net/NetHandler.h" @@ -9079,7 +9080,8 @@ TSLogFieldRegister(std::string_view name, std::string_view symbol, TSLogType typ LogField *field = new LogField( name.data(), symbol.data(), static_cast(type), - [marshal_cb](void *sm, char *buf) -> int { return marshal_cb(reinterpret_cast(sm), buf); }, unmarshal_cb); + [marshal_cb = std::move(marshal_cb)](void *sm, char *buf) -> int { return marshal_cb(reinterpret_cast(sm), buf); }, + unmarshal_cb); Log::global_field_list.add(field, false); Log::field_symbol_hash.emplace(symbol.data(), field); diff --git a/src/config/ssl_multicert.cc b/src/config/ssl_multicert.cc index 5dfdf486e15..873068df112 100644 --- a/src/config/ssl_multicert.cc +++ b/src/config/ssl_multicert.cc @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -281,7 +282,7 @@ SSLMultiCertParser::parse_yaml(std::string_view content) return {result, swoc::Errata("YAML parse error: {}", ex.what())}; } - return {result, std::move(errata)}; + return {std::move(result), std::move(errata)}; } ConfigResult @@ -337,7 +338,7 @@ SSLMultiCertParser::parse_legacy(std::string_view content) result.push_back(std::move(entry)); } - return {result, std::move(errata)}; + return {std::move(result), std::move(errata)}; } std::string diff --git a/src/config/unit_tests/test_ssl_multicert.cc b/src/config/unit_tests/test_ssl_multicert.cc index 7baae9563bc..9cf15a40396 100644 --- a/src/config/unit_tests/test_ssl_multicert.cc +++ b/src/config/unit_tests/test_ssl_multicert.cc @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -239,13 +240,13 @@ TEST_CASE("SSLMultiCertMarshaller produces valid YAML", "[ssl_multicert][marshal entry1.ssl_cert_name = "server.pem"; entry1.dest_ip = "*"; entry1.ssl_key_name = "server.key"; - config.push_back(entry1); + config.push_back(std::move(entry1)); SSLMultiCertEntry entry2; entry2.ssl_cert_name = "another.pem"; entry2.dest_ip = "[::1]:8443"; entry2.ssl_ticket_enabled = 1; - config.push_back(entry2); + config.push_back(std::move(entry2)); SSLMultiCertMarshaller marshaller; std::string yaml = marshaller.to_yaml(config); @@ -276,14 +277,14 @@ TEST_CASE("SSLMultiCertMarshaller produces valid JSON", "[ssl_multicert][marshal SSLMultiCertEntry entry1; entry1.ssl_cert_name = "server.pem"; entry1.dest_ip = "*"; - config.push_back(entry1); + config.push_back(std::move(entry1)); SSLMultiCertEntry entry2; entry2.ssl_cert_name = "another.pem"; entry2.dest_ip = "[::1]:8443"; entry2.ssl_ticket_enabled = 1; entry2.ssl_ticket_number = 5; - config.push_back(entry2); + config.push_back(std::move(entry2)); SSLMultiCertMarshaller marshaller; std::string json = marshaller.to_json(config); @@ -305,7 +306,7 @@ TEST_CASE("SSLMultiCertMarshaller handles special characters", "[ssl_multicert][ entry.ssl_cert_name = "server.pem"; entry.dest_ip = "*"; entry.ssl_key_dialog = "exec:/path/to/script \"with quotes\""; - config.push_back(entry); + config.push_back(std::move(entry)); SSLMultiCertMarshaller marshaller; diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc index 99e9fba47b4..7368e57c4e1 100644 --- a/src/iocore/cache/CacheDir.cc +++ b/src/iocore/cache/CacheDir.cc @@ -35,6 +35,7 @@ #include #include +#include #ifdef LOOP_CHECK_MODE #define DIR_LOOP_THRESHOLD 1000 @@ -932,7 +933,7 @@ sync_cache_dir_on_shutdown() for (auto &[disk, indices] : drive_stripe_map) { Dbg(dbg_ctl_cache_dir_sync, "Disk %s: syncing %zu stripe(s)", disk->path, indices.size()); auto stripe_indices = indices; - threads.emplace_back([stripe_indices]() { + threads.emplace_back([stripe_indices = std::move(stripe_indices)]() { // Use a thread_local variable to give each OS thread a unique EThread* sentinel instead of 0xdeadbeef. thread_local char thread_sentinel; EThread *t = reinterpret_cast(&thread_sentinel); diff --git a/src/iocore/net/unit_tests/test_SSLSNIConfig.cc b/src/iocore/net/unit_tests/test_SSLSNIConfig.cc index b9aa20f2668..066edfff08b 100644 --- a/src/iocore/net/unit_tests/test_SSLSNIConfig.cc +++ b/src/iocore/net/unit_tests/test_SSLSNIConfig.cc @@ -34,6 +34,7 @@ #include #include +#include #include "tscore/ink_inet.h" TEST_CASE("Test SSLSNIConfig") @@ -266,7 +267,7 @@ TEST_CASE("SNIConfig handles high-bit bytes while normalizing server names") item.inbound_port_ranges.emplace_back(1, ts::MAX_PORT_VALUE); SNIConfigParams params; - params.yaml_sni.items.push_back(item); + params.yaml_sni.items.push_back(std::move(item)); REQUIRE(params.load_sni_config()); std::string servername{"hIGH"}; diff --git a/src/mgmt/config/ConfigReloadTrace.cc b/src/mgmt/config/ConfigReloadTrace.cc index 8d3285c8a18..aae0b0f0196 100644 --- a/src/mgmt/config/ConfigReloadTrace.cc +++ b/src/mgmt/config/ConfigReloadTrace.cc @@ -27,6 +27,7 @@ #include "tsutil/ts_diag_levels.h" #include +#include #include "tsutil/Metrics.h" #include "tsutil/ts_time_parser.h" @@ -85,7 +86,7 @@ ConfigReloadTask::add_child(std::string_view description, std::string_view filen // Read token directly - can't call get_token() as it would deadlock (tries to acquire shared_lock on same mutex) auto trace = std::make_shared(_info.token, description, false, shared_from_this()); _info.sub_tasks.push_back(trace); - return ConfigContext{trace, description, filename}; + return ConfigContext{std::move(trace), description, filename}; } ConfigReloadTask & @@ -469,7 +470,7 @@ ConfigReloadProgress::check_progress(int /* etype */, void * /* data */) } ConfigReloadProgress::ConfigReloadProgress(ConfigReloadTaskPtr reload) - : Continuation(new_ProxyMutex()), _reload{reload}, _every{get_configured_check_interval()} + : Continuation(new_ProxyMutex()), _reload{std::move(reload)}, _every{get_configured_check_interval()} { SET_HANDLER(&ConfigReloadProgress::check_progress); } diff --git a/src/mgmt/config/ReloadCoordinator.cc b/src/mgmt/config/ReloadCoordinator.cc index 202a7806af1..6add40d8f00 100644 --- a/src/mgmt/config/ReloadCoordinator.cc +++ b/src/mgmt/config/ReloadCoordinator.cc @@ -126,7 +126,7 @@ ReloadCoordinator::reserve_subtask(std::string_view config_key) auto task = std::make_shared(_current_task->get_token(), config_key, false, _current_task); task->set_config_key(config_key); - _current_task->add_sub_task(task); + _current_task->add_sub_task(std::move(task)); Dbg(dbg_ctl, "Reserved subtask for config '%.*s'", static_cast(config_key.size()), config_key.data()); } @@ -153,7 +153,7 @@ ReloadCoordinator::create_config_context(std::string_view config_key, std::strin if (existing->get_state() == ConfigReloadTask::State::CREATED) { // Activate the reserved subtask Dbg(dbg_ctl, "Activating reserved subtask for config '%.*s'", static_cast(config_key.size()), config_key.data()); - return ConfigContext{existing, description, filename}; + return ConfigContext{std::move(existing), description, filename}; } // Already handled — true duplicate Dbg(dbg_ctl, "Duplicate reload for config '%.*s' — subtask already exists, skipping", static_cast(config_key.size()), @@ -168,7 +168,7 @@ ReloadCoordinator::create_config_context(std::string_view config_key, std::strin task->set_config_key(config_key); _current_task->add_sub_task(task); - ConfigContext ctx{task, description, filename}; + ConfigContext ctx{std::move(task), description, filename}; return ctx; } diff --git a/src/mgmt/rpc/handlers/config/Configuration.cc b/src/mgmt/rpc/handlers/config/Configuration.cc index 9f901bbb62e..d2b498641d0 100644 --- a/src/mgmt/rpc/handlers/config/Configuration.cc +++ b/src/mgmt/rpc/handlers/config/Configuration.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include "records/RecCore.h" #include "../../../../records/P_RecCore.h" @@ -308,7 +309,7 @@ reload_config(std::string_view const & /* id ATS_UNUSED */, YAML::Node const &pa continue; } - valid_configs.push_back({parent_key, key, it->second}); + valid_configs.push_back({std::move(parent_key), std::move(key), it->second}); } // If no valid configs, return early without creating a task diff --git a/src/proxy/Plugin.cc b/src/proxy/Plugin.cc index d6ebc46b483..16f51a3d4d9 100644 --- a/src/proxy/Plugin.cc +++ b/src/proxy/Plugin.cc @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "tscore/ink_platform.h" #include "tscore/ink_file.h" @@ -428,7 +429,7 @@ plugin_init(bool validateOnly) retVal = single_plugin_init(argc, argv, validateOnly); - s_plugin_load_summary.entries.push_back({plugin_name, -1, true, retVal, load_index}); + s_plugin_load_summary.entries.push_back({std::move(plugin_name), -1, true, retVal, load_index}); for (i = 0; i < argc; i++) { ats_free(vars[i]); diff --git a/src/proxy/logging/LogField.cc b/src/proxy/logging/LogField.cc index 485ef24033d..431208e9c3c 100644 --- a/src/proxy/logging/LogField.cc +++ b/src/proxy/logging/LogField.cc @@ -311,8 +311,8 @@ LogField::LogField(const char *name, const char *symbol, Type type, CustomMarsha m_time_field(false), m_alias_map(nullptr), m_set_func(nullptr), - m_custom_marshal_func(custom_marshal), - m_custom_unmarshal_func(custom_unmarshal) + m_custom_marshal_func(std::move(custom_marshal)), + m_custom_unmarshal_func(std::move(custom_unmarshal)) { ink_assert(m_name != nullptr); ink_assert(m_symbol != nullptr); diff --git a/src/records/unit_tests/test_ReloadDirectives.cc b/src/records/unit_tests/test_ReloadDirectives.cc index 5b90b607081..9fe697eea5c 100644 --- a/src/records/unit_tests/test_ReloadDirectives.cc +++ b/src/records/unit_tests/test_ReloadDirectives.cc @@ -187,7 +187,7 @@ TEST_CASE("ConfigContext: supplied_yaml on default context has no content", "[co TEST_CASE("ConfigContext: reload_directives round-trip via task", "[config][context][directive]") { auto task = std::make_shared("test-dir-1", "test", false, nullptr); - ConfigContext ctx(task, "test_handler"); + ConfigContext ctx(std::move(task), "test_handler"); YAML::Node directives; directives["id"] = "foo"; diff --git a/src/traffic_cache_tool/CacheDefs.h b/src/traffic_cache_tool/CacheDefs.h index 1d9a8c64644..5f77834936b 100644 --- a/src/traffic_cache_tool/CacheDefs.h +++ b/src/traffic_cache_tool/CacheDefs.h @@ -26,6 +26,7 @@ #include #include #include +#include #include "swoc/swoc_file.h" #include "swoc/Scalar.h" @@ -290,7 +291,7 @@ struct url_matcher { while (fileContent) { swoc::TextView line = fileContent.take_prefix_at('\n'); std::string reg_str(line.data(), line.size()); - str_vec.push_back(reg_str); + str_vec.push_back(std::move(reg_str)); count++; } patterns = (const char **)ats_malloc(count * sizeof(char *)); diff --git a/src/traffic_ctl/CtrlCommands.cc b/src/traffic_ctl/CtrlCommands.cc index 1f64bd45db9..8c5d51b4a46 100644 --- a/src/traffic_ctl/CtrlCommands.cc +++ b/src/traffic_ctl/CtrlCommands.cc @@ -22,12 +22,13 @@ #include #include +#include #include #include #include #include +#include #include -#include #include #include @@ -306,7 +307,7 @@ ConfigCommand::config_status() {"error", DL_Error }, }; - std::string lowered{min_level}; + std::string lowered{std::move(min_level)}; std::transform(lowered.begin(), lowered.end(), lowered.begin(), [](unsigned char c) { return static_cast(std::tolower(c)); }); @@ -942,7 +943,7 @@ HostDBCommand::status_get() }; } - HostDBGetStatusRequest request{params}; + HostDBGetStatusRequest request{std::move(params)}; auto response = invoke_rpc(request); diff --git a/src/traffic_ctl/jsonrpc/ctrl_yaml_codecs.h b/src/traffic_ctl/jsonrpc/ctrl_yaml_codecs.h index 3f9ff1016fd..0eff4952b58 100644 --- a/src/traffic_ctl/jsonrpc/ctrl_yaml_codecs.h +++ b/src/traffic_ctl/jsonrpc/ctrl_yaml_codecs.h @@ -26,6 +26,8 @@ #include "CtrlRPCRequests.h" +#include + // traffic_ctl jsonrpc request/response YAML codec implementation. namespace YAML @@ -107,7 +109,7 @@ template <> struct convert { ConfigReloadResponse::LogEntry entry; entry.level = static_cast(log["level"].as(DL_Undefined)); entry.text = log["text"].as(); - info.logs.push_back(entry); + info.logs.push_back(std::move(entry)); } else { info.logs.push_back({DL_Undefined, log.as()}); }