From 324ab5974c88873c61c8c872097650f3f82008fe Mon Sep 17 00:00:00 2001 From: Chris Kennelly Date: Wed, 16 Dec 2020 08:30:14 -0800 Subject: [PATCH] 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 --- sandboxed_api/sandbox2/network_proxy/filtering.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sandboxed_api/sandbox2/network_proxy/filtering.cc b/sandboxed_api/sandbox2/network_proxy/filtering.cc index aac47df..7984199 100644 --- a/sandboxed_api/sandbox2/network_proxy/filtering.cc +++ b/sandboxed_api/sandbox2/network_proxy/filtering.cc @@ -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(mask_or_cidr, cidr); if (!res || !*cidr) {