mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Fix issues when calling std::move(const&)
This commit is contained in:
parent
c73c8d53fe
commit
faad673716
7 changed files with 25 additions and 21 deletions
|
@ -5,6 +5,7 @@ misc-unused-using-decls,
|
|||
modernize-use-default-member-init,
|
||||
modernize-use-nullptr,
|
||||
performance-for-range-copy,
|
||||
performance-move-const-arg,
|
||||
performance-unnecessary-copy-initialization,
|
||||
readability-redundant-declaration,
|
||||
readability-redundant-string-init,
|
||||
|
@ -15,7 +16,11 @@ misc-unused-using-decls,
|
|||
modernize-use-default-member-init,
|
||||
modernize-use-nullptr,
|
||||
performance-for-range-copy,
|
||||
performance-move-const-arg,
|
||||
performance-unnecessary-copy-initialization,
|
||||
readability-redundant-declaration,
|
||||
readability-redundant-string-init,
|
||||
'
|
||||
CheckOptions:
|
||||
- key: performance-move-const-arg.CheckTriviallyCopyableMove
|
||||
value: false
|
||||
|
|
|
@ -2129,7 +2129,7 @@ static RPCHelpMan scantxoutset()
|
|||
for (const UniValue& scanobject : request.params[1].get_array().getValues()) {
|
||||
FlatSigningProvider provider;
|
||||
auto scripts = EvalDescriptorStringOrObject(scanobject, provider);
|
||||
for (const auto& script : scripts) {
|
||||
for (CScript& script : scripts) {
|
||||
std::string inferred = InferDescriptor(script, provider)->ToString();
|
||||
needles.emplace(script);
|
||||
descriptors.emplace(std::move(script), std::move(inferred));
|
||||
|
|
|
@ -572,7 +572,7 @@ public:
|
|||
if (pos++) ret += ",";
|
||||
std::string tmp;
|
||||
if (!scriptarg->ToStringHelper(arg, tmp, type, cache)) return false;
|
||||
ret += std::move(tmp);
|
||||
ret += tmp;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ public:
|
|||
tmp = pubkey->ToString();
|
||||
break;
|
||||
}
|
||||
ret += std::move(tmp);
|
||||
ret += tmp;
|
||||
}
|
||||
std::string subscript;
|
||||
if (!ToStringSubScriptHelper(arg, subscript, type, cache)) return false;
|
||||
|
@ -912,7 +912,7 @@ protected:
|
|||
}
|
||||
std::string tmp;
|
||||
if (!m_subdescriptor_args[pos]->ToStringHelper(arg, tmp, type, cache)) return false;
|
||||
ret += std::move(tmp);
|
||||
ret += tmp;
|
||||
while (!path.empty() && path.back()) {
|
||||
if (path.size() > 1) ret += '}';
|
||||
path.pop_back();
|
||||
|
|
|
@ -80,14 +80,14 @@ public:
|
|||
bool isArray() const { return (typ == VARR); }
|
||||
bool isObject() const { return (typ == VOBJ); }
|
||||
|
||||
void push_back(const UniValue& val);
|
||||
void push_back(UniValue val);
|
||||
void push_backV(const std::vector<UniValue>& vec);
|
||||
template <class It>
|
||||
void push_backV(It first, It last);
|
||||
|
||||
void __pushKV(const std::string& key, const UniValue& val);
|
||||
void pushKV(const std::string& key, const UniValue& val);
|
||||
void pushKVs(const UniValue& obj);
|
||||
void __pushKV(std::string key, UniValue val);
|
||||
void pushKV(std::string key, UniValue val);
|
||||
void pushKVs(UniValue obj);
|
||||
|
||||
std::string write(unsigned int prettyIndent = 0,
|
||||
unsigned int indentLevel = 0) const;
|
||||
|
|
|
@ -101,11 +101,11 @@ void UniValue::setObject()
|
|||
typ = VOBJ;
|
||||
}
|
||||
|
||||
void UniValue::push_back(const UniValue& val_)
|
||||
void UniValue::push_back(UniValue val)
|
||||
{
|
||||
checkType(VARR);
|
||||
|
||||
values.push_back(val_);
|
||||
values.push_back(std::move(val));
|
||||
}
|
||||
|
||||
void UniValue::push_backV(const std::vector<UniValue>& vec)
|
||||
|
@ -115,32 +115,32 @@ void UniValue::push_backV(const std::vector<UniValue>& vec)
|
|||
values.insert(values.end(), vec.begin(), vec.end());
|
||||
}
|
||||
|
||||
void UniValue::__pushKV(const std::string& key, const UniValue& val_)
|
||||
void UniValue::__pushKV(std::string key, UniValue val)
|
||||
{
|
||||
checkType(VOBJ);
|
||||
|
||||
keys.push_back(key);
|
||||
values.push_back(val_);
|
||||
keys.push_back(std::move(key));
|
||||
values.push_back(std::move(val));
|
||||
}
|
||||
|
||||
void UniValue::pushKV(const std::string& key, const UniValue& val_)
|
||||
void UniValue::pushKV(std::string key, UniValue val)
|
||||
{
|
||||
checkType(VOBJ);
|
||||
|
||||
size_t idx;
|
||||
if (findKey(key, idx))
|
||||
values[idx] = val_;
|
||||
values[idx] = std::move(val);
|
||||
else
|
||||
__pushKV(key, val_);
|
||||
__pushKV(std::move(key), std::move(val));
|
||||
}
|
||||
|
||||
void UniValue::pushKVs(const UniValue& obj)
|
||||
void UniValue::pushKVs(UniValue obj)
|
||||
{
|
||||
checkType(VOBJ);
|
||||
obj.checkType(VOBJ);
|
||||
|
||||
for (size_t i = 0; i < obj.keys.size(); i++)
|
||||
__pushKV(obj.keys[i], obj.values.at(i));
|
||||
__pushKV(std::move(obj.keys.at(i)), std::move(obj.values.at(i)));
|
||||
}
|
||||
|
||||
void UniValue::getObjMap(std::map<std::string,UniValue>& kv) const
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
void ReplaceAll(std::string& in_out, const std::string& search, const std::string& substitute)
|
||||
{
|
||||
if (search.empty()) return;
|
||||
in_out = std::regex_replace(in_out, std::regex(std::move(search)), substitute);
|
||||
in_out = std::regex_replace(in_out, std::regex(search), substitute);
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ std::map<CTxDestination, std::vector<COutput>> ListCoins(const CWallet& wallet)
|
|||
|
||||
std::map<CTxDestination, std::vector<COutput>> result;
|
||||
|
||||
for (const COutput& coin : AvailableCoinsListUnspent(wallet).All()) {
|
||||
for (COutput& coin : AvailableCoinsListUnspent(wallet).All()) {
|
||||
CTxDestination address;
|
||||
if ((coin.spendable || (wallet.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) && coin.solvable)) &&
|
||||
ExtractDestination(FindNonChangeParentOutput(wallet, coin.outpoint).scriptPubKey, address)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue