1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:57:46 +00:00

AK: Add basic Traits for RefPtr

This allows RefPtr to be stored in a HashTable<RefPtr<T>> :^)

It's unfortunate about the const_casts. We'll need to fix HashMap::get
to play nice with non-const Traits<T>::PeekType at some point.
This commit is contained in:
Andreas Kling 2020-02-16 19:36:15 +01:00
parent 9794e18a20
commit a6e69bda71
5 changed files with 13 additions and 6 deletions

View file

@ -74,8 +74,7 @@ void* dlopen(const char* filename, int flags)
auto existing_elf_object = g_elf_objects.get(file_path.basename());
if (existing_elf_object.has_value()) {
void* referenced_object = existing_elf_object.value().leak_ref();
return referenced_object;
return const_cast<ELFDynamicLoader*>(existing_elf_object.value());
}
int fd = open(filename, O_RDONLY);
@ -110,7 +109,7 @@ void* dlopen(const char* filename, int flags)
g_dlerror_msg = "Successfully loaded ELF object.";
// we have one refcount already
return g_elf_objects.get(file_path.basename()).value().ptr();
return const_cast<ELFDynamicLoader*>(g_elf_objects.get(file_path.basename()).value());
}
void* dlsym(void* handle, const char* symbol_name)