mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
Merge bitcoin/bitcoin#21996: p2p: pass strings to NetPermissions::TryParse functions by const ref
39393479c5
p2p: pass strings to NetPermissions::TryParse functions by const ref (Jon Atack) Pull request description: instead of by value, as these are "in" params that are not cheap to copy. Reference: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f16-for-in-parameters-pass-cheaply-copied-types-by-value-and-others-by-reference-to-const ACKs for top commit: MarcoFalke: cr ACK39393479c5
Tree-SHA512: 294fe0f2d900293b4447d4e1f0ccc60c1ed27b3bdbd0f5d71d3dbf71de86879638b1b813fadfb44c58b4acff4e7d75b7ed6a4f9cc5fcf627108224e6a21b524c
This commit is contained in:
commit
ff438a1966
2 changed files with 6 additions and 6 deletions
|
@ -20,8 +20,8 @@ const std::vector<std::string> NET_PERMISSIONS_DOC{
|
|||
|
||||
namespace {
|
||||
|
||||
// The parse the following format "perm1,perm2@xxxxxx"
|
||||
bool TryParsePermissionFlags(const std::string str, NetPermissionFlags& output, size_t& readen, bilingual_str& error)
|
||||
// Parse the following format: "perm1,perm2@xxxxxx"
|
||||
bool TryParsePermissionFlags(const std::string& str, NetPermissionFlags& output, size_t& readen, bilingual_str& error)
|
||||
{
|
||||
NetPermissionFlags flags = NetPermissionFlags::None;
|
||||
const auto atSeparator = str.find('@');
|
||||
|
@ -81,7 +81,7 @@ std::vector<std::string> NetPermissions::ToStrings(NetPermissionFlags flags)
|
|||
return strings;
|
||||
}
|
||||
|
||||
bool NetWhitebindPermissions::TryParse(const std::string str, NetWhitebindPermissions& output, bilingual_str& error)
|
||||
bool NetWhitebindPermissions::TryParse(const std::string& str, NetWhitebindPermissions& output, bilingual_str& error)
|
||||
{
|
||||
NetPermissionFlags flags;
|
||||
size_t offset;
|
||||
|
@ -104,7 +104,7 @@ bool NetWhitebindPermissions::TryParse(const std::string str, NetWhitebindPermis
|
|||
return true;
|
||||
}
|
||||
|
||||
bool NetWhitelistPermissions::TryParse(const std::string str, NetWhitelistPermissions& output, bilingual_str& error)
|
||||
bool NetWhitelistPermissions::TryParse(const std::string& str, NetWhitelistPermissions& output, bilingual_str& error)
|
||||
{
|
||||
NetPermissionFlags flags;
|
||||
size_t offset;
|
||||
|
|
|
@ -74,14 +74,14 @@ public:
|
|||
class NetWhitebindPermissions : public NetPermissions
|
||||
{
|
||||
public:
|
||||
static bool TryParse(const std::string str, NetWhitebindPermissions& output, bilingual_str& error);
|
||||
static bool TryParse(const std::string& str, NetWhitebindPermissions& output, bilingual_str& error);
|
||||
CService m_service;
|
||||
};
|
||||
|
||||
class NetWhitelistPermissions : public NetPermissions
|
||||
{
|
||||
public:
|
||||
static bool TryParse(const std::string str, NetWhitelistPermissions& output, bilingual_str& error);
|
||||
static bool TryParse(const std::string& str, NetWhitelistPermissions& output, bilingual_str& error);
|
||||
CSubNet m_subnet;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue