1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:17:45 +00:00

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*>.
This commit is contained in:
Itamar 2021-05-08 12:27:12 +03:00 committed by Andreas Kling
parent 1da0d402b7
commit 8a01167c7d
6 changed files with 20 additions and 7 deletions

View file

@ -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)