From a5c1c8e820ec3057f798f675bf8af19a4a29b396 Mon Sep 17 00:00:00 2001 From: Dimitry Ivanov Date: Wed, 18 May 2016 18:14:19 -0700 Subject: [PATCH] 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 --- linker/linker.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/linker/linker.cpp b/linker/linker.cpp index 3112a1e37..af23d446e 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -472,42 +472,6 @@ static void resolve_paths(std::vector& 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); } } -- 2.11.0