summaryrefslogtreecommitdiff
path: root/multinetwork
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2017-08-03 14:04:06 -0700
committerChih-Hung Hsieh <chh@google.com>2017-08-03 14:13:18 -0700
commitf6d5b0d06fc111cf87846eeecd529a202f9ed216 (patch)
treebb8f2201159584a11ccf502a837f291bae50232e /multinetwork
parentb3734fda74ff55298be8849a9ef91ee8fef17d0d (diff)
downloadextras-f6d5b0d06fc111cf87846eeecd529a202f9ed216.tar.gz
Fix clang-tidy performance-* warnings in system/extras.
* Use const reference parameter type to avoid unnecessary copy. * Use more efficient overloaded string methods. Bug: 30407689 Bug: 30411878 Test: build with WITH_TIDY=1 Change-Id: I558d482910c8a53c042d876848e35cdce8b8c15b
Diffstat (limited to 'multinetwork')
-rw-r--r--multinetwork/httpurl.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/multinetwork/httpurl.cpp b/multinetwork/httpurl.cpp
index e079c1d4..d78c0c93 100644
--- a/multinetwork/httpurl.cpp
+++ b/multinetwork/httpurl.cpp
@@ -52,7 +52,7 @@ bool parseUrl(const struct Arguments& args, struct Parameters* parameters) {
}
parameters->host = std::string(args.arg1).substr(strlen(HTTP_PREFIX));
- const auto first_slash = parameters->host.find_first_of("/");
+ const auto first_slash = parameters->host.find_first_of('/');
if (first_slash != std::string::npos) {
parameters->path = parameters->host.substr(first_slash);
parameters->host.erase(first_slash);
@@ -64,7 +64,7 @@ bool parseUrl(const struct Arguments& args, struct Parameters* parameters) {
}
if (parameters->host[0] == '[') {
- const auto closing_bracket = parameters->host.find_first_of("]");
+ const auto closing_bracket = parameters->host.find_first_of(']');
if (closing_bracket == std::string::npos) {
std::cerr << "Missing closing bracket." << std::endl;
return false;
@@ -80,7 +80,7 @@ bool parseUrl(const struct Arguments& args, struct Parameters* parameters) {
parameters->port = parameters->host.substr(closing_bracket + 2);
}
} else {
- const auto first_colon = parameters->host.find_first_of(":");
+ const auto first_colon = parameters->host.find_first_of(':');
if (first_colon != std::string::npos) {
parameters->port = parameters->host.substr(first_colon + 1);
parameters->hostname = parameters->host.substr(0, first_colon);