Fix clang-tidy performance warnings in syste/core.
* Use const reference type for parameters to avoid unnecessary copy.
* Suppress warning of not using faster overloaded string find function.
Bug: 30407689
Bug: 30411878
Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee
Test: build with WITH_TIDY=1
Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index 477edc1..193b929 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -1275,9 +1275,10 @@
return hint;
}
- // If there are any slashes in it, assume it's a relative path;
+ // If any of the OS_PATH_SEPARATORS is found, assume it's a relative path;
// make it absolute.
- if (hint.find_first_of(OS_PATH_SEPARATORS) != std::string::npos) {
+ // NOLINT: Do not complain if OS_PATH_SEPARATORS has only one character.
+ if (hint.find_first_of(OS_PATH_SEPARATORS) != std::string::npos) { // NOLINT
std::string cwd;
if (!getcwd(&cwd)) {
fprintf(stderr, "adb: getcwd failed: %s\n", strerror(errno));