mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
refactor: Use C++11 range based for loops to simplify rpc code
This commit is contained in:
parent
fa459bdc87
commit
fa89ca9b5b
@ -2407,7 +2407,7 @@ static const CRPCCommand commands[] =
|
|||||||
{ "hidden", "dumptxoutset", &dumptxoutset, {"path"} },
|
{ "hidden", "dumptxoutset", &dumptxoutset, {"path"} },
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
for (const auto& c : commands) {
|
||||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
t.appendCommand(c.name, &c);
|
||||||
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
}
|
||||||
}
|
}
|
||||||
|
@ -1200,7 +1200,7 @@ static const CRPCCommand commands[] =
|
|||||||
{ "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} },
|
{ "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} },
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
for (const auto& c : commands) {
|
||||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
t.appendCommand(c.name, &c);
|
||||||
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,7 +619,7 @@ static const CRPCCommand commands[] =
|
|||||||
{ "hidden", "echojson", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
|
{ "hidden", "echojson", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
for (const auto& c : commands) {
|
||||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
t.appendCommand(c.name, &c);
|
||||||
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
}
|
||||||
}
|
}
|
||||||
|
@ -796,7 +796,7 @@ static const CRPCCommand commands[] =
|
|||||||
{ "network", "getnodeaddresses", &getnodeaddresses, {"count"} },
|
{ "network", "getnodeaddresses", &getnodeaddresses, {"count"} },
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
for (const auto& c : commands) {
|
||||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
t.appendCommand(c.name, &c);
|
||||||
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
}
|
||||||
}
|
}
|
||||||
|
@ -1821,7 +1821,7 @@ static const CRPCCommand commands[] =
|
|||||||
{ "blockchain", "verifytxoutproof", &verifytxoutproof, {"proof"} },
|
{ "blockchain", "verifytxoutproof", &verifytxoutproof, {"proof"} },
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
for (const auto& c : commands) {
|
||||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
t.appendCommand(c.name, &c);
|
||||||
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,13 +256,8 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
|
|
||||||
CRPCTable::CRPCTable()
|
CRPCTable::CRPCTable()
|
||||||
{
|
{
|
||||||
unsigned int vcidx;
|
for (const auto& c : vRPCCommands) {
|
||||||
for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++)
|
appendCommand(c.name, &c);
|
||||||
{
|
|
||||||
const CRPCCommand *pcmd;
|
|
||||||
|
|
||||||
pcmd = &vRPCCommands[vcidx];
|
|
||||||
mapCommands[pcmd->name].push_back(pcmd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user