mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 19:37:27 -03:00
tidy: add clang-tidy modernize-use-starts-ends-with
check
This commit is contained in:
parent
2756797eca
commit
fc7b507e9a
4 changed files with 4 additions and 3 deletions
|
@ -14,6 +14,7 @@ modernize-use-emplace,
|
|||
modernize-use-equals-default,
|
||||
modernize-use-noexcept,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-starts-ends-with,
|
||||
performance-*,
|
||||
-performance-avoid-endl,
|
||||
-performance-enum-size,
|
||||
|
|
|
@ -315,7 +315,7 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
|
|||
if (i->exactMatch)
|
||||
match = (strURI == i->prefix);
|
||||
else
|
||||
match = (strURI.substr(0, i->prefix.size()) == i->prefix);
|
||||
match = strURI.starts_with(i->prefix);
|
||||
if (match) {
|
||||
path = strURI.substr(i->prefix.size());
|
||||
break;
|
||||
|
|
|
@ -1356,7 +1356,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
if (!SplitHostPort(socket_addr, port_out, host_out)) {
|
||||
#ifdef HAVE_SOCKADDR_UN
|
||||
// Allow unix domain sockets for some options e.g. unix:/some/file/path
|
||||
if (!unix || socket_addr.find(ADDR_PREFIX_UNIX) != 0) {
|
||||
if (!unix || !socket_addr.starts_with(ADDR_PREFIX_UNIX)) {
|
||||
return InitError(InvalidPortErrMsg(arg, socket_addr));
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -230,7 +230,7 @@ CService LookupNumeric(const std::string& name, uint16_t portDefault, DNSLookupF
|
|||
bool IsUnixSocketPath(const std::string& name)
|
||||
{
|
||||
#ifdef HAVE_SOCKADDR_UN
|
||||
if (name.find(ADDR_PREFIX_UNIX) != 0) return false;
|
||||
if (!name.starts_with(ADDR_PREFIX_UNIX)) return false;
|
||||
|
||||
// Split off "unix:" prefix
|
||||
std::string str{name.substr(ADDR_PREFIX_UNIX.length())};
|
||||
|
|
Loading…
Reference in a new issue