mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-29 09:55:49 +02:00
clang-tidy: Add performance-inefficient-vector-operation check
https://clang.llvm.org/extra/clang-tidy/checks/performance/inefficient-vector-operation.html
This commit is contained in:
@@ -83,6 +83,7 @@ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest&
|
||||
std::string category;
|
||||
std::set<intptr_t> setDone;
|
||||
std::vector<std::pair<std::string, const CRPCCommand*> > vCommands;
|
||||
vCommands.reserve(mapCommands.size());
|
||||
|
||||
for (const auto& entry : mapCommands)
|
||||
vCommands.push_back(make_pair(entry.second.front()->category + entry.first, entry.second.front()));
|
||||
@@ -513,6 +514,7 @@ static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& req
|
||||
std::vector<std::string> CRPCTable::listCommands() const
|
||||
{
|
||||
std::vector<std::string> commandList;
|
||||
commandList.reserve(mapCommands.size());
|
||||
for (const auto& i : mapCommands) commandList.emplace_back(i.first);
|
||||
return commandList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user