aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-05-09 11:26:58 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-05-09 18:48:52 +0200
commitfa28850562bda0c2049aaff42103dfa6f05395dc (patch)
tree985be04decca6d436b35ceec283c9023c5e1d8a4
parentfaaa60a30e7738a1490c9c2bb8963420f53c7f2d (diff)
downloadbitcoin-fa28850562bda0c2049aaff42103dfa6f05395dc.tar.xz
Fix clang-tidy performance-unnecessary-copy-initialization warnings
-rw-r--r--src/external_signer.cpp2
-rw-r--r--src/rpc/rawtransaction_util.cpp4
-rw-r--r--src/rpc/request.cpp4
-rw-r--r--src/rpc/util.cpp4
4 files changed, 7 insertions, 7 deletions
diff --git a/src/external_signer.cpp b/src/external_signer.cpp
index dc0f7e6046..6b1e1f0241 100644
--- a/src/external_signer.cpp
+++ b/src/external_signer.cpp
@@ -42,7 +42,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
if (fingerprint.isNull()) {
throw std::runtime_error(strprintf("'%s' received invalid response, missing signer fingerprint", command));
}
- const std::string fingerprintStr = fingerprint.get_str();
+ const std::string& fingerprintStr{fingerprint.get_str()};
// Skip duplicate signer
bool duplicate = false;
for (const ExternalSigner& signer : signers) {
diff --git a/src/rpc/rawtransaction_util.cpp b/src/rpc/rawtransaction_util.cpp
index a6b7a0c536..3a6fa39e4d 100644
--- a/src/rpc/rawtransaction_util.cpp
+++ b/src/rpc/rawtransaction_util.cpp
@@ -223,8 +223,8 @@ void ParsePrevouts(const UniValue& prevTxsUnival, FillableSigningProvider* keyst
{"redeemScript", UniValueType(UniValue::VSTR)},
{"witnessScript", UniValueType(UniValue::VSTR)},
}, true);
- UniValue rs = prevOut.find_value("redeemScript");
- UniValue ws = prevOut.find_value("witnessScript");
+ const UniValue& rs{prevOut.find_value("redeemScript")};
+ const UniValue& ws{prevOut.find_value("witnessScript")};
if (rs.isNull() && ws.isNull()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Missing redeemScript/witnessScript");
}
diff --git a/src/rpc/request.cpp b/src/rpc/request.cpp
index a8fdfc613e..cf1b6cd92b 100644
--- a/src/rpc/request.cpp
+++ b/src/rpc/request.cpp
@@ -168,7 +168,7 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
id = request.find_value("id");
// Parse method
- UniValue valMethod = request.find_value("method");
+ const UniValue& valMethod{request.find_value("method")};
if (valMethod.isNull())
throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
if (!valMethod.isStr())
@@ -181,7 +181,7 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser);
// Parse params
- UniValue valParams = request.find_value("params");
+ const UniValue& valParams{request.find_value("params")};
if (valParams.isArray() || valParams.isObject())
params = valParams;
else if (valParams.isNull())
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 91bd46a45a..81489d7cec 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -1133,10 +1133,10 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
if (scanobject.isStr()) {
desc_str = scanobject.get_str();
} else if (scanobject.isObject()) {
- UniValue desc_uni = scanobject.find_value("desc");
+ const UniValue& desc_uni{scanobject.find_value("desc")};
if (desc_uni.isNull()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Descriptor needs to be provided in scan object");
desc_str = desc_uni.get_str();
- UniValue range_uni = scanobject.find_value("range");
+ const UniValue& range_uni{scanobject.find_value("range")};
if (!range_uni.isNull()) {
range = ParseDescriptorRange(range_uni);
}