Skip to content

Commit de50346

Browse files
gengjiawentargos
authored andcommitted
src: apply clang-tidy performance-faster-string-find
PR-URL: #26812 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 963d7d1 commit de50346

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/inspector_socket.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ static void generate_accept_string(const std::string& client_key,
158158
}
159159

160160
static std::string TrimPort(const std::string& host) {
161-
size_t last_colon_pos = host.rfind(":");
161+
size_t last_colon_pos = host.rfind(':');
162162
if (last_colon_pos == std::string::npos)
163163
return host;
164-
size_t bracket = host.rfind("]");
164+
size_t bracket = host.rfind(']');
165165
if (bracket == std::string::npos || last_colon_pos > bracket)
166166
return host.substr(0, last_colon_pos);
167167
return host;

src/node_report.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ static void PrintSystemInformation(JSONWriter* writer) {
507507
WideCharToMultiByte(
508508
CP_UTF8, 0, lpszVariable, -1, str, size, nullptr, nullptr);
509509
std::string env(str);
510-
int sep = env.rfind("=");
510+
int sep = env.rfind('=');
511511
std::string key = env.substr(0, sep);
512512
std::string value = env.substr(sep + 1);
513513
writer->json_keyvalue(key, value);

0 commit comments

Comments
 (0)