rpc: Avoid initialization-order-fiasco on static CRPCCommand tables

This commit is contained in:
MarcoFalke
2020-04-06 00:21:33 +08:00
parent 4830077494
commit fa1a92224d
6 changed files with 12 additions and 12 deletions

View File

@@ -760,6 +760,8 @@ static UniValue getnodeaddresses(const JSONRPCRequest& request)
return ret;
}
void RegisterNetRPCCommands(CRPCTable &t)
{
// clang-format off
static const CRPCCommand commands[] =
{ // category name actor (function) argNames
@@ -780,8 +782,6 @@ static const CRPCCommand commands[] =
};
// clang-format on
void RegisterNetRPCCommands(CRPCTable &t)
{
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
}