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

LibELF: Add find_demangled_function

Also, added AK::String::index_of and fixed a bug in ELF::Loader::symbol_ptr
This commit is contained in:
Itamar 2020-04-13 19:23:19 +03:00 committed by Andreas Kling
parent 34f0d98e67
commit e207de8449
7 changed files with 71 additions and 24 deletions

View file

@ -317,6 +317,18 @@ bool String::contains(const String& needle) const
return strstr(characters(), needle.characters());
}
Optional<size_t> String::index_of(const String& needle) const
{
if (is_null() || needle.is_null())
return {};
const char* self_characters = characters();
const char* result = strstr(self_characters, needle.characters());
if (!result)
return {};
return Optional<size_t> { result - self_characters };
}
bool String::equals_ignoring_case(const StringView& other) const
{
return StringUtils::equals_ignoring_case(view(), other);

View file

@ -117,6 +117,7 @@ public:
bool equals_ignoring_case(const StringView&) const;
bool contains(const String&) const;
Optional<size_t> index_of(const String&) const;
Vector<String> split_limit(char separator, size_t limit, bool keep_empty = false) const;
Vector<String> split(char separator, bool keep_empty = false) const;