diff options
author | fanquake <fanquake@gmail.com> | 2023-10-16 14:56:54 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-10-16 15:35:50 +0100 |
commit | 08ea835220baa88a0e226eff90f66bbae3eb7a0f (patch) | |
tree | d8760ac8bc90b3524abac8f8fa13f11cd8d83633 /src/qt | |
parent | 92704535f66976c09a658348e554d47b7f7bcf6e (diff) | |
parent | fa05a726c225dc65dee79367bb67f099ae4f99e6 (diff) |
Merge bitcoin/bitcoin#28583: refactor: [tidy] modernize-use-emplace
fa05a726c225dc65dee79367bb67f099ae4f99e6 tidy: modernize-use-emplace (MarcoFalke)
Pull request description:
Constructing a temporary unnamed object only to copy or move it into a container seems both verbose in code and a strict performance penalty.
Fix both issues via the `modernize-use-emplace` tidy check.
ACKs for top commit:
Sjors:
re-utACK fa05a726c2
hebasto:
ACK fa05a726c225dc65dee79367bb67f099ae4f99e6.
TheCharlatan:
ACK fa05a726c225dc65dee79367bb67f099ae4f99e6
Tree-SHA512: 4408a094f406e7bf6c1468c2b0798f68f4d952a1253cf5b20bdc648ad7eea4a2c070051fed46d66fd37bce2ce6f85962484a1d32826b7ab8c9baba431eaa2765
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/rpcconsole.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 998a4e5cbe..ceaa3ac46b 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -169,7 +169,7 @@ public: bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strResult, const std::string &strCommand, const bool fExecute, std::string * const pstrFilteredOut, const WalletModel* wallet_model) { std::vector< std::vector<std::string> > stack; - stack.push_back(std::vector<std::string>()); + stack.emplace_back(); enum CmdParseState { @@ -197,7 +197,7 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes } // Make sure stack is not empty before adding something if (stack.empty()) { - stack.push_back(std::vector<std::string>()); + stack.emplace_back(); } stack.back().push_back(strArg); }; @@ -206,7 +206,7 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes if (nDepthInsideSensitive) { if (!--nDepthInsideSensitive) { assert(filter_begin_pos); - filter_ranges.push_back(std::make_pair(filter_begin_pos, chpos)); + filter_ranges.emplace_back(filter_begin_pos, chpos); filter_begin_pos = 0; } } @@ -306,7 +306,7 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes if (nDepthInsideSensitive) { ++nDepthInsideSensitive; } - stack.push_back(std::vector<std::string>()); + stack.emplace_back(); } // don't allow commands after executed commands on baselevel |