refactor: Remove duplicate allNetMessageTypesVec

With C++11 (and later), the duplicate variable is no longer needed.

Also, run clang-format on the namespace, as the script in the next
commit relies on a specific format. This prevents a clang-format run in
the future from breaking the script. (Review hint: --ignore-all-space).
This commit is contained in:
MarcoFalke committed 2023-07-11 19:26:52 +02:00
1 parent 21ed784614
commit fa1471e575
1 file changed
+2 -3
+2 -3
View File
@@ -52,7 +52,7 @@ const char *SENDTXRCNCL="sendtxrcncl";
/** All known message types. Keep this in the same order as the list of /** All known message types. Keep this in the same order as the list of
* messages above and in protocol.h. * messages above and in protocol.h.
*/ */
const static std::string allNetMessageTypes[] = { const static std::vector<std::string> g_all_net_message_types{
NetMsgType::VERSION, NetMsgType::VERSION,
NetMsgType::VERACK, NetMsgType::VERACK,
NetMsgType::ADDR, NetMsgType::ADDR,
@@ -89,7 +89,6 @@ const static std::string allNetMessageTypes[] = {
NetMsgType::WTXIDRELAY, NetMsgType::WTXIDRELAY,
NetMsgType::SENDTXRCNCL, NetMsgType::SENDTXRCNCL,
}; };
const static std::vector<std::string> allNetMessageTypesVec(std::begin(allNetMessageTypes), std::end(allNetMessageTypes));
CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn) CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn)
{ {
@@ -182,7 +181,7 @@ std::string CInv::ToString() const
const std::vector<std::string> &getAllNetMessageTypes() const std::vector<std::string> &getAllNetMessageTypes()
{ {
return allNetMessageTypesVec; return g_all_net_message_types;
} }
/** /**