mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Optimize calls to std::string::find() and friends for a single char.
The character literal overload is more efficient. PiperOrigin-RevId: 347827459 Change-Id: I91ab1c5ea699886b6c15ad5016338063e0c98f40
This commit is contained in:
parent
4763959227
commit
324ab5974c
|
@ -98,7 +98,7 @@ static absl::Status ParseIpAndMask(const std::string& ip_and_mask,
|
|||
}
|
||||
std::string mask_or_cidr = ip_and_mask_split[1];
|
||||
|
||||
const bool has_dot = mask_or_cidr.find(".") == absl::string_view::npos;
|
||||
const bool has_dot = mask_or_cidr.find('.') == absl::string_view::npos;
|
||||
if (has_dot) { // mask_or_cidr is cidr
|
||||
bool res = absl::SimpleAtoi<uint32_t>(mask_or_cidr, cidr);
|
||||
if (!res || !*cidr) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user