1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -41,9 +41,9 @@ void Process::handle_thread_exit(pid_t tid, EventSerialNumber serial)
thread->end_valid = serial;
}
HashMap<DeprecatedString, OwnPtr<MappedObject>> g_mapped_object_cache;
HashMap<ByteString, OwnPtr<MappedObject>> g_mapped_object_cache;
static MappedObject* get_or_create_mapped_object(DeprecatedString const& path)
static MappedObject* get_or_create_mapped_object(ByteString const& path)
{
if (auto it = g_mapped_object_cache.find(path); it != g_mapped_object_cache.end())
return it->value.ptr();
@ -67,7 +67,7 @@ static MappedObject* get_or_create_mapped_object(DeprecatedString const& path)
return ptr;
}
void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name)
void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, ByteString const& name)
{
StringView path;
if (name.contains("Loader.so"sv))
@ -82,25 +82,25 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString co
// associated base address and size as new regions are discovered.
// We don't allocate a temporary String object if an entry already exists.
// This assumes that DeprecatedString::hash and StringView::hash return the same result.
// This assumes that ByteString::hash and StringView::hash return the same result.
auto string_view_compare = [&path](auto& entry) { return path == entry.key.view(); };
if (auto existing_it = m_libraries.find(path.hash(), string_view_compare); existing_it != m_libraries.end()) {
auto& entry = *existing_it->value;
entry.base = min(entry.base, base);
entry.size = max(entry.size + size, base - entry.base + size);
} else {
DeprecatedString path_string = path.to_deprecated_string();
DeprecatedString full_path;
ByteString path_string = path.to_byte_string();
ByteString full_path;
if (path_string.starts_with('/'))
full_path = path_string;
else if (FileSystem::looks_like_shared_library(path_string))
full_path = DeprecatedString::formatted("/usr/lib/{}", path);
full_path = ByteString::formatted("/usr/lib/{}", path);
else
full_path = path_string;
auto* mapped_object = get_or_create_mapped_object(full_path);
if (!mapped_object) {
full_path = DeprecatedString::formatted("/usr/local/lib/{}", path);
full_path = ByteString::formatted("/usr/local/lib/{}", path);
mapped_object = get_or_create_mapped_object(full_path);
if (!mapped_object)
return;
@ -112,14 +112,14 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString co
Debug::DebugInfo const& LibraryMetadata::Library::load_debug_info(FlatPtr base_address) const
{
if (debug_info == nullptr)
debug_info = make<Debug::DebugInfo>(object->elf, DeprecatedString::empty(), base_address);
debug_info = make<Debug::DebugInfo>(object->elf, ByteString::empty(), base_address);
return *debug_info.ptr();
}
DeprecatedString LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const
ByteString LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const
{
if (!object)
return DeprecatedString::formatted("?? <{:p}>", ptr);
return ByteString::formatted("?? <{:p}>", ptr);
return object->elf.symbolicate(ptr - base, offset);
}