From edfec96679a4a777dbfbb866fce29c02f8bce23d Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Wed, 11 Mar 2020 07:07:55 -0700 Subject: [PATCH] adb: Avoid a couple std::string constructions With some internal API changing from "const char*" to "const std::string&", we can change a couple calling sites to directly pass a std::string reference, instead of getting the c_str() version of the string. This avoids us creating a temporary std::string for the call. Test: TreeHugger Change-Id: I2fe0760ce8bf7d352010a341005356c0a801d351 --- adb/client/file_sync_client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adb/client/file_sync_client.cpp b/adb/client/file_sync_client.cpp index cc38926a4..04ad5363d 100644 --- a/adb/client/file_sync_client.cpp +++ b/adb/client/file_sync_client.cpp @@ -1097,14 +1097,14 @@ static bool remote_build_list(SyncConnection& sc, std::vector* file_li } }; - if (!sync_ls(sc, rpath.c_str(), callback)) { + if (!sync_ls(sc, rpath, callback)) { return false; } // Check each symlink we found to see whether it's a file or directory. for (copyinfo& link_ci : linklist) { struct stat st; - if (!sync_stat_fallback(sc, link_ci.rpath.c_str(), &st)) { + if (!sync_stat_fallback(sc, link_ci.rpath, &st)) { sc.Warning("stat failed for path %s: %s", link_ci.rpath.c_str(), strerror(errno)); continue; }