diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2023-03-26 20:17:55 +0100 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2023-03-26 20:17:55 +0100 |
commit | 7e975e6cf86617346c1d8e2568f74a0252c03857 (patch) | |
tree | 4c102e4b6a5139106aa9b2f085ab57a68a36953a /src/rpc | |
parent | 516b75f66ec3ba7495fc028c750937bd66cc9bba (diff) |
clang-tidy: Add `performance-inefficient-vector-operation` check
https://clang.llvm.org/extra/clang-tidy/checks/performance/inefficient-vector-operation.html
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/server.cpp | 2 | ||||
-rw-r--r-- | src/rpc/util.cpp | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 44d7e2676b..392238a1fd 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -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; } diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index ae1440c70b..ee9e3544a4 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -608,6 +608,7 @@ bool RPCHelpMan::IsValidNumArgs(size_t num_args) const std::vector<std::string> RPCHelpMan::GetArgNames() const { std::vector<std::string> ret; + ret.reserve(m_args.size()); for (const auto& arg : m_args) { ret.emplace_back(arg.m_names); } |