1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +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:
Andreas Kling 2021-02-20 23:12:00 +01:00
parent 46c3ff2acf
commit 1997d5de1a
3 changed files with 24 additions and 24 deletions

View file

@ -219,16 +219,16 @@ public:
}
}
Symbol lookup_symbol(const StringView& name) const;
Optional<Symbol> lookup_symbol(const StringView& name) const;
private:
static u32 calculate_elf_hash(const StringView& name);
static u32 calculate_gnu_hash(const StringView& name);
DynamicObject::Symbol lookup_elf_symbol(const StringView& name) const;
DynamicObject::Symbol lookup_gnu_symbol(const StringView& name) const;
Optional<Symbol> lookup_elf_symbol(const StringView& name) const;
Optional<Symbol> lookup_gnu_symbol(const StringView& name) const;
typedef DynamicObject::Symbol (HashSection::*LookupFunction)(const StringView&) const;
typedef Optional<Symbol> (HashSection::*LookupFunction)(const StringView&) const;
LookupFunction m_lookup_function {};
};