aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/server.cpp2
-rw-r--r--src/rpc/util.cpp1
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);
}