Merge \\"Fix clang-tidy performance warnings in syste/core.\\" am: 4efbce14b5
am: 4c4fa90462
Change-Id: I66bacc66df316cca09afba3ae043bd0a3035da22
This commit is contained in:
commit
d072ed3634
10 changed files with 13 additions and 12 deletions
|
|
@ -111,7 +111,7 @@ TEST(adb_utils, adb_dirname) {
|
||||||
EXPECT_EQ("/system/bin", adb_dirname("/system/bin/sh/"));
|
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.
|
// Test creating a directory hierarchy.
|
||||||
EXPECT_TRUE(mkdirs(basepath));
|
EXPECT_TRUE(mkdirs(basepath));
|
||||||
// Test finding an existing directory hierarchy.
|
// Test finding an existing directory hierarchy.
|
||||||
|
|
|
||||||
|
|
@ -1331,9 +1331,10 @@ static std::string find_product_out_path(const std::string& hint) {
|
||||||
return hint;
|
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.
|
// 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;
|
std::string cwd;
|
||||||
if (!getcwd(&cwd)) {
|
if (!getcwd(&cwd)) {
|
||||||
fprintf(stderr, "adb: getcwd failed: %s\n", strerror(errno));
|
fprintf(stderr, "adb: getcwd failed: %s\n", strerror(errno));
|
||||||
|
|
|
||||||
|
|
@ -433,7 +433,7 @@ class SyncConnection {
|
||||||
typedef void (sync_ls_cb)(unsigned mode, unsigned size, unsigned time, const char* name);
|
typedef void (sync_ls_cb)(unsigned mode, unsigned size, unsigned time, const char* name);
|
||||||
|
|
||||||
static bool sync_ls(SyncConnection& sc, const char* path,
|
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;
|
if (!sc.SendRequest(ID_LIST, path)) return false;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
||||||
|
|
@ -895,7 +895,7 @@ static std::string verify_slot(Transport* transport, const char *slot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_for_partition(Transport* transport, const char *part, const char *slot,
|
static void do_for_partition(Transport* transport, const char *part, const char *slot,
|
||||||
std::function<void(const std::string&)> func, bool force_slot) {
|
const std::function<void(const std::string&)>& func, bool force_slot) {
|
||||||
std::string has_slot;
|
std::string has_slot;
|
||||||
std::string current_slot;
|
std::string current_slot;
|
||||||
|
|
||||||
|
|
@ -927,7 +927,7 @@ static void do_for_partition(Transport* transport, const char *part, const char
|
||||||
* partition does not support slots.
|
* partition does not support slots.
|
||||||
*/
|
*/
|
||||||
static void do_for_partitions(Transport* transport, const char *part, const char *slot,
|
static void do_for_partitions(Transport* transport, const char *part, const char *slot,
|
||||||
std::function<void(const std::string&)> func, bool force_slot) {
|
const std::function<void(const std::string&)>& func, bool force_slot) {
|
||||||
std::string has_slot;
|
std::string has_slot;
|
||||||
|
|
||||||
if (slot && strcmp(slot, "all") == 0) {
|
if (slot && strcmp(slot, "all") == 0) {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ static constexpr int kTestTimeoutMs = 3000;
|
||||||
// Creates connected sockets |server| and |client|. Returns true on success.
|
// Creates connected sockets |server| and |client|. Returns true on success.
|
||||||
bool MakeConnectedSockets(Socket::Protocol protocol, std::unique_ptr<Socket>* server,
|
bool MakeConnectedSockets(Socket::Protocol protocol, std::unique_ptr<Socket>* server,
|
||||||
std::unique_ptr<Socket>* client,
|
std::unique_ptr<Socket>* client,
|
||||||
const std::string hostname = "localhost") {
|
const std::string& hostname = "localhost") {
|
||||||
*server = Socket::NewServer(protocol, 0);
|
*server = Socket::NewServer(protocol, 0);
|
||||||
if (*server == nullptr) {
|
if (*server == nullptr) {
|
||||||
ADD_FAILURE() << "Failed to create server.";
|
ADD_FAILURE() << "Failed to create server.";
|
||||||
|
|
|
||||||
|
|
@ -850,7 +850,7 @@ Service* ServiceManager::FindServiceByKeychord(int keychord_id) const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceManager::ForEachService(std::function<void(Service*)> callback) const {
|
void ServiceManager::ForEachService(const std::function<void(Service*)>& callback) const {
|
||||||
for (const auto& s : services_) {
|
for (const auto& s : services_) {
|
||||||
callback(s.get());
|
callback(s.get());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ public:
|
||||||
Service* FindServiceByName(const std::string& name) const;
|
Service* FindServiceByName(const std::string& name) const;
|
||||||
Service* FindServiceByPid(pid_t pid) const;
|
Service* FindServiceByPid(pid_t pid) const;
|
||||||
Service* FindServiceByKeychord(int keychord_id) const;
|
Service* FindServiceByKeychord(int keychord_id) const;
|
||||||
void ForEachService(std::function<void(Service*)> callback) const;
|
void ForEachService(const std::function<void(Service*)>& callback) const;
|
||||||
void ForEachServiceInClass(const std::string& classname,
|
void ForEachServiceInClass(const std::string& classname,
|
||||||
void (*func)(Service* svc)) const;
|
void (*func)(Service* svc)) const;
|
||||||
void ForEachServiceWithFlags(unsigned matchflags,
|
void ForEachServiceWithFlags(unsigned matchflags,
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,7 @@ int wait_for_file(const char *filename, int timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
void import_kernel_cmdline(bool in_qemu,
|
void import_kernel_cmdline(bool in_qemu,
|
||||||
std::function<void(const std::string&, const std::string&, bool)> fn) {
|
const std::function<void(const std::string&, const std::string&, bool)>& fn) {
|
||||||
std::string cmdline;
|
std::string cmdline;
|
||||||
android::base::ReadFileToString("/proc/cmdline", &cmdline);
|
android::base::ReadFileToString("/proc/cmdline", &cmdline);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ void make_link_init(const char *oldpath, const char *newpath);
|
||||||
void remove_link(const char *oldpath, const char *newpath);
|
void remove_link(const char *oldpath, const char *newpath);
|
||||||
int wait_for_file(const char *filename, int timeout);
|
int wait_for_file(const char *filename, int timeout);
|
||||||
void import_kernel_cmdline(bool in_qemu,
|
void import_kernel_cmdline(bool in_qemu,
|
||||||
std::function<void(const std::string&, const std::string&, bool)>);
|
const std::function<void(const std::string&, const std::string&, bool)>&);
|
||||||
int make_dir(const char *path, mode_t mode);
|
int make_dir(const char *path, mode_t mode);
|
||||||
int restorecon(const char *pathname);
|
int restorecon(const char *pathname);
|
||||||
int restorecon_recursive(const char *pathname);
|
int restorecon_recursive(const char *pathname);
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ static ucontext_t GetUContextFromUnwContext(const unw_context_t& unw_context) {
|
||||||
return ucontext;
|
return ucontext;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OfflineBacktraceFunctionCall(std::function<int(void (*)(void*), void*)> function,
|
static void OfflineBacktraceFunctionCall(const std::function<int(void (*)(void*), void*)>& function,
|
||||||
std::vector<uintptr_t>* pc_values) {
|
std::vector<uintptr_t>* pc_values) {
|
||||||
// Create a thread to generate the needed stack and registers information.
|
// Create a thread to generate the needed stack and registers information.
|
||||||
g_exit_flag = false;
|
g_exit_flag = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue