src: apply clang-tidy performance-faster-string-find · nodejs/node@de50346 (original) (raw)
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -158,10 +158,10 @@ static void generate_accept_string(const std::string& client_key, | ||
158 | 158 | } |
159 | 159 | |
160 | 160 | static std::string TrimPort(const std::string& host) { |
161 | -size_t last_colon_pos = host.rfind(":"); | |
161 | +size_t last_colon_pos = host.rfind(':'); | |
162 | 162 | if (last_colon_pos == std:🧵:npos) |
163 | 163 | return host; |
164 | -size_t bracket = host.rfind("]"); | |
164 | +size_t bracket = host.rfind(']'); | |
165 | 165 | if (bracket == std:🧵:npos | |
166 | 166 | return host.substr(0, last_colon_pos); |
167 | 167 | return host; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -507,7 +507,7 @@ static void PrintSystemInformation(JSONWriter* writer) { | ||
507 | 507 | WideCharToMultiByte( |
508 | 508 | CP_UTF8, 0, lpszVariable, -1, str, size, nullptr, nullptr); |
509 | 509 | std::string env(str); |
510 | -int sep = env.rfind("="); | |
510 | +int sep = env.rfind('='); | |
511 | 511 | std::string key = env.substr(0, sep); |
512 | 512 | std::string value = env.substr(sep + 1); |
513 | 513 | writer->json_keyvalue(key, value); |