Use "" to indicate the oat filename could not be computed.
Instead of having an extra boolean flag.
Test: oat file assistant tests.
Change-Id: I91249ba862522e691c6b67fd28a2eac58dcde07e
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 046c80e..aae9d97 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -87,7 +87,6 @@
if (oat_location != nullptr) {
cached_oat_file_name_ = std::string(oat_location);
cached_oat_file_name_attempted_ = true;
- cached_oat_file_name_found_ = true;
}
}
@@ -357,15 +356,13 @@
cached_odex_file_name_attempted_ = true;
std::string error_msg;
- cached_odex_file_name_found_ = DexFilenameToOdexFilename(
- dex_location_, isa_, &cached_odex_file_name_, &error_msg);
- if (!cached_odex_file_name_found_) {
+ if (!DexFilenameToOdexFilename(dex_location_, isa_, &cached_odex_file_name_, &error_msg)) {
// If we can't figure out the odex file, we treat it as if the odex
// file was inaccessible.
LOG(WARNING) << "Failed to determine odex file name: " << error_msg;
}
}
- return cached_odex_file_name_found_ ? &cached_odex_file_name_ : nullptr;
+ return cached_odex_file_name_.empty() ? nullptr : &cached_odex_file_name_;
}
bool OatFileAssistant::OdexFileExists() {
@@ -426,16 +423,15 @@
std::string cache_dir = StringPrintf("%s%s",
DalvikCacheDirectory().c_str(), GetInstructionSetString(isa_));
std::string error_msg;
- cached_oat_file_name_found_ = GetDalvikCacheFilename(dex_location_.c_str(),
- cache_dir.c_str(), &cached_oat_file_name_, &error_msg);
- if (!cached_oat_file_name_found_) {
+ if (!GetDalvikCacheFilename(dex_location_.c_str(),
+ cache_dir.c_str(), &cached_oat_file_name_, &error_msg)) {
// If we can't determine the oat file name, we treat the oat file as
// inaccessible.
LOG(WARNING) << "Failed to determine oat file name for dex location "
<< dex_location_ << ": " << error_msg;
}
}
- return cached_oat_file_name_found_ ? &cached_oat_file_name_ : nullptr;
+ return cached_oat_file_name_.empty() ? nullptr : &cached_oat_file_name_;
}
bool OatFileAssistant::OatFileExists() {