Skip to content

Commit fa28850

Browse files
author
MarcoFalke
committed
Fix clang-tidy performance-unnecessary-copy-initialization warnings
1 parent faaa60a commit fa28850

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/external_signer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
4242
if (fingerprint.isNull()) {
4343
throw std::runtime_error(strprintf("'%s' received invalid response, missing signer fingerprint", command));
4444
}
45-
const std::string fingerprintStr = fingerprint.get_str();
45+
const std::string& fingerprintStr{fingerprint.get_str()};
4646
// Skip duplicate signer
4747
bool duplicate = false;
4848
for (const ExternalSigner& signer : signers) {

src/rpc/rawtransaction_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ void ParsePrevouts(const UniValue& prevTxsUnival, FillableSigningProvider* keyst
223223
{"redeemScript", UniValueType(UniValue::VSTR)},
224224
{"witnessScript", UniValueType(UniValue::VSTR)},
225225
}, true);
226-
UniValue rs = prevOut.find_value("redeemScript");
227-
UniValue ws = prevOut.find_value("witnessScript");
226+
const UniValue& rs{prevOut.find_value("redeemScript")};
227+
const UniValue& ws{prevOut.find_value("witnessScript")};
228228
if (rs.isNull() && ws.isNull()) {
229229
throw JSONRPCError(RPC_INVALID_PARAMETER, "Missing redeemScript/witnessScript");
230230
}

src/rpc/request.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
168168
id = request.find_value("id");
169169

170170
// Parse method
171-
UniValue valMethod = request.find_value("method");
171+
const UniValue& valMethod{request.find_value("method")};
172172
if (valMethod.isNull())
173173
throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
174174
if (!valMethod.isStr())
@@ -181,7 +181,7 @@ void JSONRPCRequest::parse(const UniValue& valRequest)
181181
LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser);
182182

183183
// Parse params
184-
UniValue valParams = request.find_value("params");
184+
const UniValue& valParams{request.find_value("params")};
185185
if (valParams.isArray() || valParams.isObject())
186186
params = valParams;
187187
else if (valParams.isNull())

src/rpc/util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,10 +1133,10 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
11331133
if (scanobject.isStr()) {
11341134
desc_str = scanobject.get_str();
11351135
} else if (scanobject.isObject()) {
1136-
UniValue desc_uni = scanobject.find_value("desc");
1136+
const UniValue& desc_uni{scanobject.find_value("desc")};
11371137
if (desc_uni.isNull()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Descriptor needs to be provided in scan object");
11381138
desc_str = desc_uni.get_str();
1139-
UniValue range_uni = scanobject.find_value("range");
1139+
const UniValue& range_uni{scanobject.find_value("range")};
11401140
if (!range_uni.isNull()) {
11411141
range = ParseDescriptorRange(range_uni);
11421142
}

0 commit comments

Comments
 (0)