mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:27:35 +00:00
LibELF: Make symbol lookup functions return Optional<Symbol>
It was very confusing how these functions used the "undefined" state of Symbol to signal lookup failure. Let's use Optional<T> to make things a bit more understandable.
This commit is contained in:
parent
46c3ff2acf
commit
1997d5de1a
3 changed files with 24 additions and 24 deletions
|
@ -140,11 +140,12 @@ bool DynamicLoader::validate()
|
|||
|
||||
void* DynamicLoader::symbol_for_name(const StringView& name)
|
||||
{
|
||||
auto symbol = m_dynamic_object->hash_section().lookup_symbol(name);
|
||||
|
||||
auto result = m_dynamic_object->hash_section().lookup_symbol(name);
|
||||
if (!result.has_value())
|
||||
return nullptr;
|
||||
auto symbol = result.value();
|
||||
if (symbol.is_undefined())
|
||||
return nullptr;
|
||||
|
||||
return m_dynamic_object->base_address().offset(symbol.value()).as_ptr();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue