Merge \"Fix clang-tidy performance warnings in syste/core.\"
am: 4efbce14b5
Change-Id: I84f6b0134fae6e9f40710f243f4825e3f31fa15f
diff --git a/adb_utils_test.cpp b/adb_utils_test.cpp
index aabc5d7..9daa397 100644
--- a/adb_utils_test.cpp
+++ b/adb_utils_test.cpp
@@ -111,7 +111,7 @@
EXPECT_EQ("/system/bin", adb_dirname("/system/bin/sh/"));
}
-void test_mkdirs(const std::string basepath) {
+void test_mkdirs(const std::string& basepath) {
// Test creating a directory hierarchy.
EXPECT_TRUE(mkdirs(basepath));
// Test finding an existing directory hierarchy.
diff --git a/commandline.cpp b/commandline.cpp
index 46a6365..8aab389 100644
--- a/commandline.cpp
+++ b/commandline.cpp
@@ -1331,9 +1331,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));
diff --git a/file_sync_client.cpp b/file_sync_client.cpp
index 651e8ca..6302eb7 100644
--- a/file_sync_client.cpp
+++ b/file_sync_client.cpp
@@ -433,7 +433,7 @@
typedef void (sync_ls_cb)(unsigned mode, unsigned size, unsigned time, const char* name);
static bool sync_ls(SyncConnection& sc, const char* path,
- std::function<sync_ls_cb> func) {
+ const std::function<sync_ls_cb>& func) {
if (!sc.SendRequest(ID_LIST, path)) return false;
while (true) {