mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 18:23:16 +02:00
clang-tidy: Add performance-faster-string-find
check
https://clang.llvm.org/extra/clang-tidy/checks/performance/faster-string-find.html
This commit is contained in:
@@ -5,6 +5,7 @@ bugprone-use-after-move,
|
||||
misc-unused-using-decls,
|
||||
modernize-use-default-member-init,
|
||||
modernize-use-nullptr,
|
||||
performance-faster-string-find,
|
||||
performance-for-range-copy,
|
||||
performance-move-const-arg,
|
||||
performance-no-automatic-move,
|
||||
|
@@ -732,12 +732,12 @@ UniValue RPCArg::MatchesType(const UniValue& request) const
|
||||
|
||||
std::string RPCArg::GetFirstName() const
|
||||
{
|
||||
return m_names.substr(0, m_names.find("|"));
|
||||
return m_names.substr(0, m_names.find('|'));
|
||||
}
|
||||
|
||||
std::string RPCArg::GetName() const
|
||||
{
|
||||
CHECK_NONFATAL(std::string::npos == m_names.find("|"));
|
||||
CHECK_NONFATAL(std::string::npos == m_names.find('|'));
|
||||
return m_names;
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypa
|
||||
}
|
||||
// Finds whether it is hardened
|
||||
uint32_t path = 0;
|
||||
size_t pos = item.find("'");
|
||||
size_t pos = item.find('\'');
|
||||
if (pos != std::string::npos) {
|
||||
// The hardened tick can only be in the last index of the string
|
||||
if (pos != item.size() - 1) {
|
||||
|
@@ -96,7 +96,7 @@ static bool IsZMQAddressIPV6(const std::string &zmq_address)
|
||||
{
|
||||
const std::string tcp_prefix = "tcp://";
|
||||
const size_t tcp_index = zmq_address.rfind(tcp_prefix);
|
||||
const size_t colon_index = zmq_address.rfind(":");
|
||||
const size_t colon_index = zmq_address.rfind(':');
|
||||
if (tcp_index == 0 && colon_index != std::string::npos) {
|
||||
const std::string ip = zmq_address.substr(tcp_prefix.length(), colon_index - tcp_prefix.length());
|
||||
CNetAddr addr;
|
||||
|
Reference in New Issue
Block a user