diff options
author | Itamar <itamar8910@gmail.com> | 2021-05-08 12:27:12 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-08 18:10:56 +0200 |
commit | 8a01167c7dc5acbbee636c66017f5f35e8766865 (patch) | |
tree | cf33399863bcc4d6a05a6aea7a5c316e92ba3f71 /Userland/Libraries/LibELF | |
parent | 1da0d402b7f3476b30d7482ba63d8ad5d215dd96 (diff) | |
download | serenity-8a01167c7dc5acbbee636c66017f5f35e8766865.zip |
AK: Add missing GenericTraits<NonnullRefPtr>
This enables us to use keys of type NonnullRefPtr in HashMaps and
HashTables.
This commit also includes fixes in various places that used
HashMap<T, NonnullRefPtr<U>>::get() and expected to get an
Optional<NonnullRefPtr<U>> and now get an Optional<U*>.
Diffstat (limited to 'Userland/Libraries/LibELF')
-rw-r--r-- | Userland/Libraries/LibELF/DynamicLinker.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp index 3423e517a4..6551d9db55 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.cpp +++ b/Userland/Libraries/LibELF/DynamicLinker.cpp @@ -311,7 +311,7 @@ static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> load_main_library(co loader.load_stage_4(); } - return main_library_loader; + return NonnullRefPtr<DynamicLoader>(*main_library_loader); } static Result<void, DlErrorMessage> __dlclose(void* handle) @@ -377,7 +377,8 @@ static Result<void*, DlErrorMessage> __dlopen(const char* filename, int flags) auto existing_elf_object = s_global_objects.get(library_name); if (existing_elf_object.has_value()) { // It's up to the caller to release the ref with dlclose(). - return &existing_elf_object->leak_ref(); + existing_elf_object.value()->ref(); + return *existing_elf_object; } VERIFY(!library_name.is_empty()); @@ -406,7 +407,8 @@ static Result<void*, DlErrorMessage> __dlopen(const char* filename, int flags) return DlErrorMessage { "Could not load ELF object." }; // It's up to the caller to release the ref with dlclose(). - return &object->leak_ref(); + object.value()->ref(); + return *object; } static Result<void*, DlErrorMessage> __dlsym(void* handle, const char* symbol_name) |