This is an automated email from the ASF dual-hosted git repository.
jvanderzee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 19104d4c3e Fix a bunch of COPY_INSTEAD_OF_MOVE Coverity CIDs (#11668)
19104d4c3e is described below
commit 19104d4c3e0f74bc121d090aefa92a245a66d4b5
Author: JosiahWI <[email protected]>
AuthorDate: Wed Aug 14 11:10:48 2024 -0500
Fix a bunch of COPY_INSTEAD_OF_MOVE Coverity CIDs (#11668)
* Fix CID 1512704
* Fix CID 1512704
* Fix CID 1512706
* Fix CID 1512707
* Fix CID 1512711
* Fix CID 1512714
* Fix CID 1512717
* Fix CID 1512720
* Fix CID 1512727
* Fix CID 1512728
* Fix CID 1512736
* Fix CID 1512749
* Fix CID 1523652
* Fix CID 1523652
* Fix CID 1528552
* Fix CID 1528556
* Fix CID 1528559
* Fix CID 1528560 and CID 1528578
* Fix CID 1528561
* Fix CID 1528566
* Fix CID 1528574
* Fix CID 1528575
* Fix CID 1528588
* Fix CID 1528595
* Implement changes requested by Chris McFarlen
* Move resources consistently in statichit
There are two places close to each other where a temporary string is
copied
into a member. The first, which is fixed and has an associated CID, was
copied into a `std::filesystem::path`. The second, which strangely has no
associated CID, is copying into a `std::string`. For consistency, this
adds
a `std::move` to the second spot as well.
* Inline temporary values to avoid copy, rather than calling `std::move()`.
* Use a reference for the temporary in traffic_layout
The variable is simply an alias for the other variable to indicate that
it
has been sanitized. Aliases don't need to be copies.
---
plugins/esi/test/vars_test.cc | 15 ++++++++-------
plugins/experimental/magick/magick.cc | 3 ++-
plugins/experimental/stek_share/log_store.cc | 5 ++++-
plugins/experimental/stek_share/state_machine.h | 5 +++--
plugins/experimental/stek_share/stek_share.cc | 5 +++--
plugins/s3_auth/aws_auth_v4.cc | 3 ++-
plugins/statichit/statichit.cc | 6 ++++--
src/iocore/hostdb/P_HostDBProcessor.h | 7 ++++---
src/iocore/net/P_SSLCertLookup.h | 3 ++-
src/iocore/net/SSLSNIConfig.cc | 3 ++-
src/iocore/net/SSLSessionCache.cc | 7 +++----
src/iocore/net/SSLSessionCache.h | 6 ++++--
src/iocore/net/SSLUtils.cc | 13 ++++++++-----
src/iocore/net/YamlSNIConfig.cc | 4 ++--
src/mgmt/rpc/handlers/common/RecordsUtils.cc | 3 ++-
src/proxy/ControlBase.cc | 3 ++-
src/proxy/HostStatus.cc | 6 ++++--
src/proxy/http/PreWarmManager.cc | 3 ++-
src/proxy/http/remap/PluginDso.cc | 3 ++-
src/traffic_layout/engine.cc | 10 +++++-----
20 files changed, 68 insertions(+), 45 deletions(-)
diff --git a/plugins/esi/test/vars_test.cc b/plugins/esi/test/vars_test.cc
index 677d7045a7..03ae490106 100644
--- a/plugins/esi/test/vars_test.cc
+++ b/plugins/esi/test/vars_test.cc
@@ -21,9 +21,10 @@
limitations under the License.
*/
+#include <cstdarg>
#include <cstdio>
#include <string>
-#include <cstdarg>
+#include <utility>
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
@@ -63,7 +64,7 @@ TEST_CASE("esi vars test")
allowlistCookies.push_back("c4");
allowlistCookies.push_back("c5");
int dummy;
- Variables esi_vars(&dummy, allowlistCookies);
+ Variables esi_vars(&dummy, std::move(allowlistCookies));
const char *strings[] = {"Cookie",
"; c1=v1; c2=v2; ; c3; c4=; c5=v5 ",
"Host",
@@ -290,7 +291,7 @@ TEST_CASE("esi vars test")
{
enableFakeDebugLog();
int dummy;
- Variables esi_vars(&dummy, allowlistCookies);
+ Variables esi_vars(&dummy, std::move(allowlistCookies));
esi_vars.populate(HttpHeader("Host", -1, "example.com", -1));
esi_vars.populate(HttpHeader("Referer", -1, "google.com", -1));
@@ -329,7 +330,7 @@ TEST_CASE("esi vars test")
allowlistCookies.push_back("t5");
allowlistCookies.push_back("c1");
int dummy;
- Variables esi_vars(&dummy, allowlistCookies);
+ Variables esi_vars(&dummy, std::move(allowlistCookies));
esi_vars.populate(HttpHeader("Host", -1, "example.com", -1));
esi_vars.populate(HttpHeader("Referer", -1, "google.com", -1));
@@ -373,7 +374,7 @@ TEST_CASE("esi vars test")
allowlistCookies.push_back("a");
allowlistCookies.push_back("c");
int dummy;
- Variables esi_vars(&dummy, allowlistCookies);
+ Variables esi_vars(&dummy, std::move(allowlistCookies));
string cookie_str("FPS=dl;
mb=d=OPsv7rvU4FFaAOoIRi75BBuqdMdbMLFuDwQmk6nKrCgno7L4xuN44zm7QBQJRmQSh8ken6GSVk8-&v=1;
C=mg=1; "
"Y=v=1&n=fmaptagvuff50&l=fc0d94i7/o&p=m2f0000313000400&r=8j&lg=en-US&intl=us; "
"F=a=4KvLV9IMvTJnIAqCk25y9Use6hnPALtUf3n78PihlcIqvmzoW.Ax8UyW8_oxtgFNrrdmooqZmPa7WsX4gE."
@@ -416,7 +417,7 @@ TEST_CASE("esi vars test")
SECTION("Test 5")
{
int dummy;
- Variables esi_vars(&dummy, allowlistCookies);
+ Variables esi_vars(&dummy, std::move(allowlistCookies));
esi_vars.populate(HttpHeader("hdr1", -1, "hval1", -1));
esi_vars.populate(HttpHeader("Hdr2", -1, "hval2", -1));
esi_vars.populate(HttpHeader("@Intenal-hdr1", -1, "internal-hval1", -1));
@@ -434,7 +435,7 @@ TEST_CASE("esi vars test")
{
allowlistCookies.push_back("*");
int dummy;
- Variables esi_vars(&dummy, allowlistCookies);
+ Variables esi_vars(&dummy, std::move(allowlistCookies));
esi_vars.populate(HttpHeader("Host", -1, "example.com", -1));
esi_vars.populate(HttpHeader("Cookie", -1, "age=21; grade=-5; avg=4.3;
t1=\" \"; t2=0.0", -1));
diff --git a/plugins/experimental/magick/magick.cc
b/plugins/experimental/magick/magick.cc
index 460f82f1c1..3cf09a8330 100644
--- a/plugins/experimental/magick/magick.cc
+++ b/plugins/experimental/magick/magick.cc
@@ -25,6 +25,7 @@
#include <map>
#include <mutex>
#include <string>
+#include <utility>
#include <vector>
#include <cassert>
@@ -358,7 +359,7 @@ struct QueryMap {
std::string content_;
Map map_;
- QueryMap(std::string &&s) : content_(s) { parse(); }
+ QueryMap(std::string &&s) : content_(std::move(s)) { parse(); }
template <typename T>
const Vector &
diff --git a/plugins/experimental/stek_share/log_store.cc
b/plugins/experimental/stek_share/log_store.cc
index 5c1e6f428e..94b3eb55c9 100644
--- a/plugins/experimental/stek_share/log_store.cc
+++ b/plugins/experimental/stek_share/log_store.cc
@@ -18,6 +18,7 @@ limitations under the License.
// This file is based on the example code from
https://github.com/eBay/NuRaft/tree/master/examples
#include <cassert>
+#include <utility>
#include <libnuraft/nuraft.hxx>
@@ -82,6 +83,8 @@ STEKShareLogStore::append(nuraft::ptr<nuraft::log_entry>
&entry)
void
STEKShareLogStore::write_at(uint64_t index, nuraft::ptr<nuraft::log_entry>
&entry)
{
+ // We prepare what we can before taking the logs lock to minimize how long
+ // we hold it.
nuraft::ptr<nuraft::log_entry> clone = make_clone(entry);
// Discard all logs equal to or greater than "index".
@@ -90,7 +93,7 @@ STEKShareLogStore::write_at(uint64_t index,
nuraft::ptr<nuraft::log_entry> &entr
while (itr != logs_.end()) {
itr = logs_.erase(itr);
}
- logs_[index] = clone;
+ logs_[index] = std::move(clone);
}
nuraft::ptr<std::vector<nuraft::ptr<nuraft::log_entry>>>
diff --git a/plugins/experimental/stek_share/state_machine.h
b/plugins/experimental/stek_share/state_machine.h
index 3cfa2e7d7e..eabe0a87dc 100644
--- a/plugins/experimental/stek_share/state_machine.h
+++ b/plugins/experimental/stek_share/state_machine.h
@@ -21,9 +21,10 @@ limitations under the License.
#include <atomic>
#include <cassert>
+#include <cstring>
#include <iostream>
#include <mutex>
-#include <cstring>
+#include <utility>
#include <libnuraft/nuraft.hxx>
@@ -144,7 +145,7 @@ public:
{
std::lock_guard<std::mutex> l(snapshot_lock_);
- snapshot_ = ctx;
+ snapshot_ = std::move(ctx);
}
obj_id++;
diff --git a/plugins/experimental/stek_share/stek_share.cc
b/plugins/experimental/stek_share/stek_share.cc
index 109f9e092e..d4e5e4ecce 100644
--- a/plugins/experimental/stek_share/stek_share.cc
+++ b/plugins/experimental/stek_share/stek_share.cc
@@ -25,6 +25,7 @@
#include <iostream>
#include <fstream>
#include <thread>
+#include <utility>
#include <openssl/ssl.h>
#include <ts/ts.h>
@@ -78,14 +79,14 @@ void
backup_config(std::shared_ptr<PluginConfig> config)
{
std::unique_lock lock(plugin_config_old_mutex);
- plugin_config_old = config;
+ plugin_config_old = std::move(config);
}
void
restore_config(std::shared_ptr<PluginConfig> config)
{
std::unique_lock lock(plugin_config_mutex);
- plugin_config = config;
+ plugin_config = std::move(config);
}
static int
diff --git a/plugins/s3_auth/aws_auth_v4.cc b/plugins/s3_auth/aws_auth_v4.cc
index f5399d1322..0242d9408c 100644
--- a/plugins/s3_auth/aws_auth_v4.cc
+++ b/plugins/s3_auth/aws_auth_v4.cc
@@ -27,6 +27,7 @@
#include <ctime> /* strftime(), time(), gmtime_r() */
#include <iomanip> /* std::setw */
#include <sstream> /* std::stringstream */
+#include <utility> /* std::move */
#include <openssl/sha.h> /* SHA(), sha256_Update(), SHA256_Final, etc. */
#include <openssl/hmac.h> /* HMAC() */
@@ -397,7 +398,7 @@ getCanonicalRequestSha256Hash(TsInterface &api, bool
signPayload, const StringSe
signedHeadersSet.insert(lowercaseName);
if (headersMap.find(lowercaseName) == headersMap.end()) {
- headersMap[lowercaseName] = trimValue;
+ headersMap[lowercaseName] = std::move(trimValue);
} else {
headersMap[lowercaseName].append(",").append(trimValue);
}
diff --git a/plugins/statichit/statichit.cc b/plugins/statichit/statichit.cc
index 8b60ffc335..37f240ca76 100644
--- a/plugins/statichit/statichit.cc
+++ b/plugins/statichit/statichit.cc
@@ -42,6 +42,8 @@
#include "ts/ts.h"
#include "ts/remap.h"
+#include <utility>
+
constexpr char PLUGIN[] = "statichit";
static DbgCtl dbg_ctl{PLUGIN};
@@ -71,12 +73,12 @@ struct StaticHitConfig {
base_path = std::filesystem::weakly_canonical(base_path);
if (std::filesystem::is_directory(base_path)) {
- dirPath = base_path;
+ dirPath = std::move(base_path);
filePath = "";
disableExact = true;
} else {
dirPath = "";
- filePath = base_path;
+ filePath = std::move(base_path);
disableExact = exact;
}
}
diff --git a/src/iocore/hostdb/P_HostDBProcessor.h
b/src/iocore/hostdb/P_HostDBProcessor.h
index 0d183ca498..e93812cfc1 100644
--- a/src/iocore/hostdb/P_HostDBProcessor.h
+++ b/src/iocore/hostdb/P_HostDBProcessor.h
@@ -27,8 +27,6 @@
#pragma once
-#include <unordered_map>
-
#include "swoc/swoc_file.h"
#include <tsutil/TsSharedMutex.h>
@@ -37,6 +35,9 @@
#include "tscore/PendingAction.h"
#include "tsutil/Metrics.h"
+#include <unordered_map>
+#include <utility>
+
using ts::Metrics;
//
@@ -258,7 +259,7 @@ struct HostDBContinuation : public Continuation {
Ptr<HostDBRecord>
lookup_done(const char *query_name, ts_seconds answer_ttl, SRVHosts *s =
nullptr, Ptr<HostDBRecord> record = Ptr<HostDBRecord>{})
{
- return this->lookup_done(swoc::TextView{query_name, strlen(query_name)},
answer_ttl, s, record);
+ return this->lookup_done(swoc::TextView{query_name, strlen(query_name)},
answer_ttl, s, std::move(record));
}
Ptr<HostDBRecord> lookup_done(swoc::TextView query_name, ts_seconds
answer_ttl, SRVHosts *s = nullptr,
diff --git a/src/iocore/net/P_SSLCertLookup.h b/src/iocore/net/P_SSLCertLookup.h
index e591f5d04c..9c5cd67a1e 100644
--- a/src/iocore/net/P_SSLCertLookup.h
+++ b/src/iocore/net/P_SSLCertLookup.h
@@ -27,6 +27,7 @@
#include <openssl/ssl.h>
#include <mutex>
#include <unordered_map>
+#include <utility>
#include "iocore/eventsystem/ConfigProcessor.h"
#include "iocore/net/SSLTypes.h"
@@ -108,7 +109,7 @@ public:
}
SSLCertContext(shared_SSL_CTX sc, SSLCertContextType ctx_type,
shared_SSLMultiCertConfigParams u, shared_ssl_ticket_key_block kb)
- : ctx_mutex(), ctx(sc), ctx_type(ctx_type), opt(u->opt), userconfig(u),
keyblock(kb)
+ : ctx_mutex(), ctx(sc), ctx_type(ctx_type), opt(u->opt), userconfig(u),
keyblock(std::move(kb))
{
}
diff --git a/src/iocore/net/SSLSNIConfig.cc b/src/iocore/net/SSLSNIConfig.cc
index 43e4d76e26..d17f884bc5 100644
--- a/src/iocore/net/SSLSNIConfig.cc
+++ b/src/iocore/net/SSLSNIConfig.cc
@@ -52,6 +52,7 @@
#include <pcre.h>
#include <algorithm>
#include <functional>
+#include <utility>
namespace
{
@@ -384,5 +385,5 @@ SNIConfig::release(SNIConfigParams *params)
void
SNIConfig::set_on_reconfigure_callback(std::function<void()> cb)
{
- SNIConfig::on_reconfigure = cb;
+ SNIConfig::on_reconfigure = std::move(cb);
}
diff --git a/src/iocore/net/SSLSessionCache.cc
b/src/iocore/net/SSLSessionCache.cc
index 90eaceec23..e293848130 100644
--- a/src/iocore/net/SSLSessionCache.cc
+++ b/src/iocore/net/SSLSessionCache.cc
@@ -350,11 +350,10 @@ SSLOriginSessionCache::insert_session(const std::string
&lookup_key, SSL_SESSION
Dbg(dbg_ctl_ssl_origin_session_cache, "insert session: %s = %p",
lookup_key.c_str(), sess_ptr);
- // Create the shared pointer to the session, with the custom deleter
- std::shared_ptr<SSL_SESSION> shared_sess(sess_ptr, SSLSessDeleter);
ssl_curve_id curve = (ssl == nullptr) ? 0 :
SSLGetCurveNID(ssl);
- std::unique_ptr<SSLOriginSession> ssl_orig_session(new
SSLOriginSession(lookup_key, curve, shared_sess));
- auto new_node = ssl_orig_session.release();
+ std::unique_ptr<SSLOriginSession> ssl_orig_session(
+ new SSLOriginSession(lookup_key, curve,
std::shared_ptr<SSL_SESSION>{sess_ptr, SSLSessDeleter}));
+ auto new_node = ssl_orig_session.release();
std::unique_lock lock(mutex);
auto entry = orig_sess_map.find(lookup_key);
diff --git a/src/iocore/net/SSLSessionCache.h b/src/iocore/net/SSLSessionCache.h
index ee23b2a2b0..e7e8d6b691 100644
--- a/src/iocore/net/SSLSessionCache.h
+++ b/src/iocore/net/SSLSessionCache.h
@@ -29,9 +29,11 @@
#include "../../../src/iocore/net/P_SSLUtils.h"
#include "ts/apidefs.h"
#include <openssl/ssl.h>
-#include <mutex>
#include <tsutil/TsSharedMutex.h>
+#include <mutex>
+#include <utility>
+
#define SSL_MAX_SESSION_SIZE 256
#define SSL_MAX_ORIG_SESSION_SIZE 4096
@@ -192,7 +194,7 @@ public:
std::shared_ptr<SSL_SESSION> shared_sess = nullptr;
SSLOriginSession(const std::string &lookup_key, ssl_curve_id curve,
std::shared_ptr<SSL_SESSION> session)
- : key(lookup_key), curve_id(curve), shared_sess(session)
+ : key(lookup_key), curve_id(curve), shared_sess(std::move(session))
{
}
diff --git a/src/iocore/net/SSLUtils.cc b/src/iocore/net/SSLUtils.cc
index 6fbca38ce8..141af5aae3 100644
--- a/src/iocore/net/SSLUtils.cc
+++ b/src/iocore/net/SSLUtils.cc
@@ -78,6 +78,8 @@
#include <openssl/ts.h>
#endif
+#include <utility>
+
using namespace std::literals;
// ssl_multicert.config field names:
@@ -1676,8 +1678,9 @@ SSLMultiCertConfigLoader::_store_ssl_ctx(SSLCertLookup
*lookup, const shared_SSL
std::vector<SSLLoadingContext> ctxs = this->init_server_ssl_ctx(data,
sslMultCertSettings.get());
for (const auto &loadingctx : ctxs) {
- shared_SSL_CTX ctx(loadingctx.ctx, SSL_CTX_free);
- if (!sslMultCertSettings || !this->_store_single_ssl_ctx(lookup,
sslMultCertSettings, ctx, loadingctx.ctx_type, common_names)) {
+ if (!sslMultCertSettings ||
+ !this->_store_single_ssl_ctx(lookup, sslMultCertSettings,
shared_SSL_CTX{loadingctx.ctx, SSL_CTX_free}, loadingctx.ctx_type,
+ common_names)) {
if (!common_names.empty()) {
std::string names;
for (auto const &name : data.cert_names_list) {
@@ -1709,8 +1712,8 @@ SSLMultiCertConfigLoader::_store_ssl_ctx(SSLCertLookup
*lookup, const shared_SSL
std::vector<SSLLoadingContext> ctxs =
this->init_server_ssl_ctx(single_data, sslMultCertSettings.get());
for (const auto &loadingctx : ctxs) {
- shared_SSL_CTX unique_ctx(loadingctx.ctx, SSL_CTX_free);
- if (!this->_store_single_ssl_ctx(lookup, sslMultCertSettings,
unique_ctx, loadingctx.ctx_type, iter->second)) {
+ if (!this->_store_single_ssl_ctx(lookup, sslMultCertSettings,
shared_SSL_CTX{loadingctx.ctx, SSL_CTX_free},
+ loadingctx.ctx_type, iter->second)) {
retval = false;
} else {
lookup->register_cert_secrets(data.cert_names_list, iter->second);
@@ -2373,7 +2376,7 @@ SSLMultiCertConfigLoader::load_certs(SSL_CTX *ctx, const
std::vector<std::string
if (secret_key_data.empty()) {
Dbg(dbg_ctl_ssl_load, "empty private key for public key %s",
cert_names_list[i].c_str());
- secret_key_data = secret_data;
+ secret_key_data = std::move(secret_data);
}
if (!SSLPrivateKeyHandler(ctx, keyPath.c_str(), secret_key_data.data(),
secret_key_data.size())) {
SSLError("failed to load certificate: %s of length %ld with key path:
%s", cert_names_list[i].c_str(), secret_key_data.size(),
diff --git a/src/iocore/net/YamlSNIConfig.cc b/src/iocore/net/YamlSNIConfig.cc
index 21a6e91999..8e46e3fc16 100644
--- a/src/iocore/net/YamlSNIConfig.cc
+++ b/src/iocore/net/YamlSNIConfig.cc
@@ -342,8 +342,8 @@ template <> struct convert<YamlSNIConfig::Item> {
if (!dir.empty() && (dir[0] != '/')) {
dir = RecConfigReadConfigDir() + '/' + dir;
}
- item.verify_client_ca_file = file;
- item.verify_client_ca_dir = dir;
+ item.verify_client_ca_file = std::move(file);
+ item.verify_client_ca_dir = std::move(dir);
#endif
}
diff --git a/src/mgmt/rpc/handlers/common/RecordsUtils.cc
b/src/mgmt/rpc/handlers/common/RecordsUtils.cc
index bd02cbc649..0d2291c0b4 100644
--- a/src/mgmt/rpc/handlers/common/RecordsUtils.cc
+++ b/src/mgmt/rpc/handlers/common/RecordsUtils.cc
@@ -22,6 +22,7 @@
#include <system_error>
#include <string>
+#include <utility>
#include "convert.h"
#include "../../../../records/P_RecCore.h"
@@ -197,7 +198,7 @@ get_yaml_record(std::string const &name, ValidateRecType
check)
Context ctx;
// Set the validation callback.
- ctx.checkCb = check;
+ ctx.checkCb = std::move(check);
// librecords will use the callback we provide in the ctx.checkCb to run the
validation.
get_record_impl(name, ctx);
diff --git a/src/proxy/ControlBase.cc b/src/proxy/ControlBase.cc
index 69c9c757aa..dfc325ab03 100644
--- a/src/proxy/ControlBase.cc
+++ b/src/proxy/ControlBase.cc
@@ -42,6 +42,7 @@
#include "proxy/ControlMatcher.h"
#include "proxy/hdrs/HdrUtils.h"
+#include <utility>
#include <vector>
/** Used for printing IP address.
@@ -126,7 +127,7 @@ TimeMod::make(char *value, const char **error)
*error = "Malformed time range";
} else if (nullptr == (*error = timeOfDayToSeconds(rangeTok[0],
&tmp.start_time)) &&
nullptr == (*error = timeOfDayToSeconds(rangeTok[1],
&tmp.end_time))) {
- mod = new TimeMod(tmp);
+ mod = new TimeMod(std::move(tmp));
}
return mod;
}
diff --git a/src/proxy/HostStatus.cc b/src/proxy/HostStatus.cc
index 388acd67e8..c708da37c8 100644
--- a/src/proxy/HostStatus.cc
+++ b/src/proxy/HostStatus.cc
@@ -20,7 +20,6 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-#include <fstream>
#include "tsutil/ts_bw_format.h"
#include "proxy/HostStatus.h"
#include "iocore/eventsystem/Tasks.h"
@@ -28,6 +27,9 @@
#include "mgmt/rpc/jsonrpc/JsonRPC.h"
#include "shared/rpc/RPCRequests.h"
+#include <fstream>
+#include <utility>
+
namespace
{
const std::string STATUS_LIST_KEY{"statusList"};
@@ -170,7 +172,7 @@ HostStatus::loadFromPersistentStore()
const YAML::Node &host = *it;
std::string hostName = host[HOST_NAME_KEY].as<std::string>();
std::string status = host[STATUS_KEY].as<std::string>();
- HostStatRec h(status);
+ HostStatRec h(std::move(status));
loadRecord(hostName, h);
}
} catch (std::exception const &ex) {
diff --git a/src/proxy/http/PreWarmManager.cc b/src/proxy/http/PreWarmManager.cc
index 8b68670519..416e6a55d8 100644
--- a/src/proxy/http/PreWarmManager.cc
+++ b/src/proxy/http/PreWarmManager.cc
@@ -35,6 +35,7 @@
#include "tsutil/PostScript.h"
#include <algorithm>
+#include <utility>
#define PreWarmSMDbg(fmt, ...) Dbg(dbg_ctl_prewarm_sm, "[%p] " fmt, this,
##__VA_ARGS__);
#define PreWarmSMVDbg(fmt, ...) Dbg(dbg_ctl_v_prewarm_sm, "[%p] " fmt, this,
##__VA_ARGS__);
@@ -1131,7 +1132,7 @@ PreWarmManager::_parse_sni_conf(PreWarm::ParsedSNIConf
&parsed_conf, const SNICo
);
// clang-format on
- parsed_conf[dst] = conf;
+ parsed_conf[dst] = std::move(conf);
}
}
}
diff --git a/src/proxy/http/remap/PluginDso.cc
b/src/proxy/http/remap/PluginDso.cc
index f7b548df6d..6c23823687 100644
--- a/src/proxy/http/remap/PluginDso.cc
+++ b/src/proxy/http/remap/PluginDso.cc
@@ -39,6 +39,7 @@
#endif
#include <cstdlib>
+#include <utility>
namespace
{
@@ -407,7 +408,7 @@
PluginDso::LoadedPlugins::addPluginPathToDsoOptOutTable(std::string_view pluginP
{
SCOPED_MUTEX_LOCK(lock, _mutex, this_ethread());
-
_optoutDsoReloadPlugins.push_front(DisableDSOReloadPluginInfo{effectivePath});
+
_optoutDsoReloadPlugins.push_front(DisableDSOReloadPluginInfo{std::move(effectivePath)});
}
return true;
diff --git a/src/traffic_layout/engine.cc b/src/traffic_layout/engine.cc
index 77a2b07c26..06bcb38a02 100644
--- a/src/traffic_layout/engine.cc
+++ b/src/traffic_layout/engine.cc
@@ -36,6 +36,7 @@
#include <fstream>
#include <iostream>
+#include <utility>
#include <ftw.h>
#include <yaml-cpp/yaml.h>
#include <grp.h>
@@ -272,11 +273,10 @@ LayoutEngine::create_runroot()
try {
YAML::Node yamlfile = YAML::LoadFile(layout_file);
for (const auto &it : yamlfile) {
- std::string key = it.first.as<std::string>();
- std::string value = it.second.as<std::string>();
- auto iter = new_map.find(key);
+ std::string key = it.first.as<std::string>();
+ auto iter = new_map.find(key);
if (iter != new_map.end()) {
- iter->second = value;
+ iter->second = it.second.as<std::string>();
} else {
if (key != "prefix") {
ink_warning("Unknown item from %s: '%s'", layout_file.c_str(),
key.c_str());
@@ -362,7 +362,7 @@ LayoutEngine::remove_runroot()
return;
}
- std::string clean_root = path;
+ std::string &clean_root = path;
append_slash(clean_root);
if (arguments.get("force")) {