Merge "linker_namespace: move sonames instead of copying" am: d2e85ae45b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2319860 Change-Id: I353715ed4c72fa02177349012faad23e7d11c871 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
fa8b45adff
2 changed files with 12 additions and 10 deletions
|
@ -39,6 +39,7 @@
|
|||
#include <sys/vfs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
@ -2484,11 +2485,12 @@ bool link_namespaces(android_namespace_t* namespace_from,
|
|||
return false;
|
||||
}
|
||||
|
||||
auto sonames = android::base::Split(shared_lib_sonames, ":");
|
||||
std::unordered_set<std::string> sonames_set(sonames.begin(), sonames.end());
|
||||
std::vector<std::string> sonames = android::base::Split(shared_lib_sonames, ":");
|
||||
std::unordered_set<std::string> sonames_set(std::make_move_iterator(sonames.begin()),
|
||||
std::make_move_iterator(sonames.end()));
|
||||
|
||||
ProtectedDataGuard guard;
|
||||
namespace_from->add_linked_namespace(namespace_to, sonames_set, false);
|
||||
namespace_from->add_linked_namespace(namespace_to, std::move(sonames_set), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ struct android_namespace_t;
|
|||
struct android_namespace_link_t {
|
||||
public:
|
||||
android_namespace_link_t(android_namespace_t* linked_namespace,
|
||||
const std::unordered_set<std::string>& shared_lib_sonames,
|
||||
std::unordered_set<std::string> shared_lib_sonames,
|
||||
bool allow_all_shared_libs)
|
||||
: linked_namespace_(linked_namespace), shared_lib_sonames_(shared_lib_sonames),
|
||||
allow_all_shared_libs_(allow_all_shared_libs)
|
||||
{}
|
||||
: linked_namespace_(linked_namespace),
|
||||
shared_lib_sonames_(std::move(shared_lib_sonames)),
|
||||
allow_all_shared_libs_(allow_all_shared_libs) {}
|
||||
|
||||
android_namespace_t* linked_namespace() const {
|
||||
return linked_namespace_;
|
||||
|
@ -127,10 +127,10 @@ struct android_namespace_t {
|
|||
return linked_namespaces_;
|
||||
}
|
||||
void add_linked_namespace(android_namespace_t* linked_namespace,
|
||||
const std::unordered_set<std::string>& shared_lib_sonames,
|
||||
std::unordered_set<std::string> shared_lib_sonames,
|
||||
bool allow_all_shared_libs) {
|
||||
linked_namespaces_.push_back(
|
||||
android_namespace_link_t(linked_namespace, shared_lib_sonames, allow_all_shared_libs));
|
||||
linked_namespaces_.emplace_back(linked_namespace, std::move(shared_lib_sonames),
|
||||
allow_all_shared_libs);
|
||||
}
|
||||
|
||||
void add_soinfo(soinfo* si) {
|
||||
|
|
Loading…
Reference in a new issue