diff options
| author | 2019-03-26 06:23:19 -0700 | |
|---|---|---|
| committer | 2019-03-26 09:28:16 -0700 | |
| commit | 8042c37f15940479d9d89a97646555a01161a334 (patch) | |
| tree | 5b153c59044f78b26879b59c4862b23fba310ced | |
| parent | c10e80f5eaf6cf72581c2706405b1f286d2050b0 (diff) | |
dexopt: Avoid a couple std::string copies
There are a couple places where we're taking a std::string and
then passing the result of c_str() to function taking a
const std::string reference. This inefficiently creates a
temporary object. We change these to directly pass the
std::string.
Test: TreeHugger
Change-Id: Ied6f13e5e2b7b71c992d325ce285fd829bdb7ee9
| -rw-r--r-- | cmds/installd/dexopt.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp index 20142aab3b..a5cc0df77e 100644 --- a/cmds/installd/dexopt.cpp +++ b/cmds/installd/dexopt.cpp @@ -1564,7 +1564,7 @@ class RunDexoptAnalyzer : public ExecVHelper { if (vdex_fd >= 0) { AddArg(vdex_fd_arg); } - AddArg(zip_fd_arg.c_str()); + AddArg(zip_fd_arg); if (profile_was_updated) { AddArg(assume_profile_changed); } @@ -1572,9 +1572,9 @@ class RunDexoptAnalyzer : public ExecVHelper { AddArg(downgrade_flag); } if (class_loader_context != nullptr) { - AddArg(class_loader_context_arg.c_str()); + AddArg(class_loader_context_arg); if (!class_loader_context_fds.empty()) { - AddArg(class_loader_context_fds_arg.c_str()); + AddArg(class_loader_context_fds_arg); } } @@ -2259,7 +2259,7 @@ bool reconcile_secondary_dex_file(const std::string& dex_path, drop_capabilities(uid); const char* volume_uuid_cstr = volume_uuid == nullptr ? nullptr : volume_uuid->c_str(); - if (!validate_secondary_dex_path(pkgname.c_str(), dex_path.c_str(), volume_uuid_cstr, + if (!validate_secondary_dex_path(pkgname, dex_path, volume_uuid_cstr, uid, storage_flag)) { LOG(ERROR) << "Could not validate secondary dex path " << dex_path; _exit(kReconcileSecondaryDexValidationError); |