Do not check zip-entry validity on create_namespace
This operation is the most expensive one and since it is unlikely that the zip-entry name is invalid (given that it is constructed by the platform) - it can removed. The worst case scenario is dlopen() of non-existing libraries taking more time. And this use-case is not on the critical path. Bug: http://b/28801010 Change-Id: I10a6b0bf342404ab72f0f5102ebf19f6c06ee6bf
This commit is contained in:
parent
041cf17cdd
commit
a5c1c8e820
|
@ -472,42 +472,6 @@ static void resolve_paths(std::vector<std::string>& paths,
|
|||
continue;
|
||||
}
|
||||
|
||||
ZipArchiveHandle handle = nullptr;
|
||||
void* cookie = nullptr;
|
||||
auto zip_guard = make_scope_guard([&]() {
|
||||
if (cookie != nullptr) {
|
||||
EndIteration(cookie);
|
||||
}
|
||||
if (handle != nullptr) {
|
||||
CloseArchive(handle);
|
||||
}
|
||||
});
|
||||
if (OpenArchive(resolved_path, &handle) != 0) {
|
||||
DL_WARN("Warning: unable to open zip archive: %s", resolved_path);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if zip-file has a dir with entry_path name
|
||||
std::string prefix_str = entry_path + "/";
|
||||
ZipString prefix(prefix_str.c_str());
|
||||
|
||||
ZipEntry out_data;
|
||||
ZipString out_name;
|
||||
|
||||
int32_t error_code;
|
||||
|
||||
if ((error_code = StartIteration(handle, &cookie, &prefix, nullptr)) != 0) {
|
||||
DL_WARN("Unable to iterate over zip-archive entries \"%s\";"
|
||||
" error code: %d", zip_path.c_str(), error_code);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Next(cookie, &out_data, &out_name) != 0) {
|
||||
DL_WARN("Unable to find entries starting with \"%s\" in \"%s\"",
|
||||
prefix_str.c_str(), zip_path.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
resolved_paths->push_back(std::string(resolved_path) + kZipFileSeparator + entry_path);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue