Optimize calls to std::string::find() and friends for a single char.
The character literal overload is more efficient. PiperOrigin-RevId: 348124169 Change-Id: I55909265a8267017210eb0deff5091da20d8ed70
This commit is contained in:
parent
3356a4d4f3
commit
c04bf06bfc
@ -53,7 +53,7 @@ Status ValidateHostPortPair(const string& host_port) {
|
||||
uint32 port;
|
||||
auto colon_index = host_port.find_last_of(':');
|
||||
if (!strings::safe_strtou32(host_port.substr(colon_index + 1), &port) ||
|
||||
host_port.substr(0, colon_index).find("/") != string::npos) {
|
||||
host_port.substr(0, colon_index).find('/') != string::npos) {
|
||||
return errors::InvalidArgument("Could not interpret \"", host_port,
|
||||
"\" as a host-port pair.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user