mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:47:46 +00:00
Everywhere: Pass AK::StringView by value
This commit is contained in:
parent
ad5d217e76
commit
8b1108e485
392 changed files with 978 additions and 978 deletions
|
@ -58,7 +58,7 @@ static Result<void*, DlErrorMessage> __dlopen(const char* filename, int flags);
|
|||
static Result<void*, DlErrorMessage> __dlsym(void* handle, const char* symbol_name);
|
||||
static Result<void, DlErrorMessage> __dladdr(void* addr, Dl_info* info);
|
||||
|
||||
Optional<DynamicObject::SymbolLookupResult> DynamicLinker::lookup_global_symbol(const StringView& name)
|
||||
Optional<DynamicObject::SymbolLookupResult> DynamicLinker::lookup_global_symbol(StringView name)
|
||||
{
|
||||
Optional<DynamicObject::SymbolLookupResult> weak_result;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace ELF {
|
|||
|
||||
class DynamicLinker {
|
||||
public:
|
||||
static Optional<DynamicObject::SymbolLookupResult> lookup_global_symbol(const StringView& symbol);
|
||||
static Optional<DynamicObject::SymbolLookupResult> lookup_global_symbol(StringView symbol);
|
||||
[[noreturn]] static void linker_main(String&& main_program_name, int fd, bool is_secure, int argc, char** argv, char** envp);
|
||||
|
||||
private:
|
||||
|
|
|
@ -249,7 +249,7 @@ const ElfW(Phdr) * DynamicObject::program_headers() const
|
|||
return (const ElfW(Phdr)*)(m_base_address.as_ptr() + header->e_phoff);
|
||||
}
|
||||
|
||||
auto DynamicObject::HashSection::lookup_sysv_symbol(const StringView& name, u32 hash_value) const -> Optional<Symbol>
|
||||
auto DynamicObject::HashSection::lookup_sysv_symbol(StringView name, u32 hash_value) const -> Optional<Symbol>
|
||||
{
|
||||
u32* hash_table_begin = (u32*)address().as_ptr();
|
||||
size_t num_buckets = hash_table_begin[0];
|
||||
|
@ -273,7 +273,7 @@ auto DynamicObject::HashSection::lookup_sysv_symbol(const StringView& name, u32
|
|||
return {};
|
||||
}
|
||||
|
||||
auto DynamicObject::HashSection::lookup_gnu_symbol(const StringView& name, u32 hash_value) const -> Optional<Symbol>
|
||||
auto DynamicObject::HashSection::lookup_gnu_symbol(StringView name, u32 hash_value) const -> Optional<Symbol>
|
||||
{
|
||||
// Algorithm reference: https://ent-voy.blogspot.com/2011/02/
|
||||
using BloomWord = FlatPtr;
|
||||
|
@ -437,7 +437,7 @@ const char* DynamicObject::name_for_dtag(ElfW(Sword) d_tag)
|
|||
}
|
||||
}
|
||||
|
||||
auto DynamicObject::lookup_symbol(const StringView& name) const -> Optional<SymbolLookupResult>
|
||||
auto DynamicObject::lookup_symbol(StringView name) const -> Optional<SymbolLookupResult>
|
||||
{
|
||||
return lookup_symbol(HashSymbol { name });
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ u32 DynamicObject::HashSymbol::sysv_hash() const
|
|||
return m_sysv_hash.value();
|
||||
}
|
||||
|
||||
void* DynamicObject::symbol_for_name(const StringView& name)
|
||||
void* DynamicObject::symbol_for_name(StringView name)
|
||||
{
|
||||
auto result = hash_section().lookup_symbol(name);
|
||||
if (!result.has_value())
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
class Section {
|
||||
public:
|
||||
Section(const DynamicObject& dynamic, unsigned section_offset, unsigned section_size_bytes, unsigned entry_size, const StringView& name)
|
||||
Section(const DynamicObject& dynamic, unsigned section_offset, unsigned section_size_bytes, unsigned entry_size, StringView name)
|
||||
: m_dynamic(dynamic)
|
||||
, m_section_offset(section_offset)
|
||||
, m_section_size_bytes(section_size_bytes)
|
||||
|
@ -212,7 +212,7 @@ public:
|
|||
|
||||
class HashSymbol {
|
||||
public:
|
||||
HashSymbol(const StringView& name)
|
||||
HashSymbol(StringView name)
|
||||
: m_name(name)
|
||||
{
|
||||
}
|
||||
|
@ -243,8 +243,8 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
Optional<Symbol> lookup_sysv_symbol(const StringView& name, u32 hash_value) const;
|
||||
Optional<Symbol> lookup_gnu_symbol(const StringView& name, u32 hash) const;
|
||||
Optional<Symbol> lookup_sysv_symbol(StringView name, u32 hash_value) const;
|
||||
Optional<Symbol> lookup_gnu_symbol(StringView name, u32 hash) const;
|
||||
|
||||
HashType m_hash_type {};
|
||||
};
|
||||
|
@ -320,7 +320,7 @@ public:
|
|||
const ELF::DynamicObject* dynamic_object { nullptr }; // The object in which the symbol is defined
|
||||
};
|
||||
|
||||
Optional<SymbolLookupResult> lookup_symbol(const StringView& name) const;
|
||||
Optional<SymbolLookupResult> lookup_symbol(StringView name) const;
|
||||
Optional<SymbolLookupResult> lookup_symbol(const HashSymbol& symbol) const;
|
||||
|
||||
// Will be called from _fixup_plt_entry, as part of the PLT trampoline
|
||||
|
@ -328,7 +328,7 @@ public:
|
|||
|
||||
bool elf_is_dynamic() const { return m_is_elf_dynamic; }
|
||||
|
||||
void* symbol_for_name(const StringView& name);
|
||||
void* symbol_for_name(StringView name);
|
||||
|
||||
private:
|
||||
explicit DynamicObject(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace ELF {
|
||||
|
||||
constexpr u32 compute_sysv_hash(const StringView& name)
|
||||
constexpr u32 compute_sysv_hash(StringView name)
|
||||
{
|
||||
// SYSV ELF hash algorithm
|
||||
// Note that the GNU HASH algorithm has less collisions
|
||||
|
@ -30,7 +30,7 @@ constexpr u32 compute_sysv_hash(const StringView& name)
|
|||
return hash;
|
||||
}
|
||||
|
||||
constexpr u32 compute_gnu_hash(const StringView& name)
|
||||
constexpr u32 compute_gnu_hash(StringView name)
|
||||
{
|
||||
// GNU ELF hash algorithm
|
||||
u32 hash = 5381;
|
||||
|
|
|
@ -252,7 +252,7 @@ Optional<Image::RelocationSection> Image::Section::relocations() const
|
|||
return static_cast<RelocationSection>(relocation_section.value());
|
||||
}
|
||||
|
||||
Optional<Image::Section> Image::lookup_section(const StringView& name) const
|
||||
Optional<Image::Section> Image::lookup_section(StringView name) const
|
||||
{
|
||||
VERIFY(m_valid);
|
||||
for (unsigned i = 0; i < section_count(); ++i) {
|
||||
|
@ -354,7 +354,7 @@ StringView Image::Symbol::raw_data() const
|
|||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
Optional<Image::Symbol> Image::find_demangled_function(const StringView& name) const
|
||||
Optional<Image::Symbol> Image::find_demangled_function(StringView name) const
|
||||
{
|
||||
Optional<Image::Symbol> found;
|
||||
for_each_symbol([&](const Image::Symbol& symbol) {
|
||||
|
|
|
@ -217,7 +217,7 @@ public:
|
|||
template<VoidFunction<ProgramHeader> F>
|
||||
void for_each_program_header(F) const;
|
||||
|
||||
Optional<Section> lookup_section(StringView const& name) const;
|
||||
Optional<Section> lookup_section(StringView name) const;
|
||||
|
||||
bool is_executable() const { return header().e_type == ET_EXEC; }
|
||||
bool is_relocatable() const { return header().e_type == ET_REL; }
|
||||
|
@ -233,7 +233,7 @@ public:
|
|||
|
||||
bool has_symbols() const { return symbol_count(); }
|
||||
#ifndef KERNEL
|
||||
Optional<Symbol> find_demangled_function(const StringView& name) const;
|
||||
Optional<Symbol> find_demangled_function(StringView name) const;
|
||||
String symbolicate(FlatPtr address, u32* offset = nullptr) const;
|
||||
#endif
|
||||
Optional<Image::Symbol> find_symbol(FlatPtr address, u32* offset = nullptr) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue