Avoid going through char* for std::string API
Bug: 13186058
(cherry picked from commit 14ae4a873e91ae8cb1c00013579b5b058268879d)
Change-Id: Ib529cc10abc2d413e9da65c043dbc2638b734acd
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 6897f8a..1c721c9 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -545,11 +545,8 @@
const char* oat_cache_filename,
std::string* error_msg) {
Locks::mutator_lock_->AssertNotHeld(Thread::Current()); // Avoid starving GC.
- std::string dex2oat_string(GetAndroidRoot());
- dex2oat_string += (kIsDebugBuild ? "/bin/dex2oatd" : "/bin/dex2oat");
- const char* dex2oat = dex2oat_string.c_str();
-
- const char* class_path = Runtime::Current()->GetClassPathString().c_str();
+ std::string dex2oat(GetAndroidRoot());
+ dex2oat += (kIsDebugBuild ? "/bin/dex2oatd" : "/bin/dex2oat");
gc::Heap* heap = Runtime::Current()->GetHeap();
std::string boot_image_option("--boot-image=");
@@ -573,7 +570,7 @@
argv.push_back("--runtime-arg");
argv.push_back("-classpath");
argv.push_back("--runtime-arg");
- argv.push_back(class_path);
+ argv.push_back(Runtime::Current()->GetClassPathString());
if (!kIsTargetBuild) {
argv.push_back("--host");
}