1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 07:47:34 +00:00

Everywhere: Add sv suffix to strings relying on StringView(char const*)

Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -61,9 +61,9 @@ struct [[gnu::packed]] MemoryRegionInfo {
#ifndef KERNEL
String object_name() const
{
StringView memory_region_name { region_name };
if (memory_region_name.contains("Loader.so"))
return "Loader.so";
StringView memory_region_name { region_name, strlen(region_name) };
if (memory_region_name.contains("Loader.so"sv))
return "Loader.so"sv;
auto maybe_colon_index = memory_region_name.find(':');
if (!maybe_colon_index.has_value())
return {};

View file

@ -397,9 +397,9 @@ void DynamicLoader::load_program_headers()
StringBuilder builder;
builder.append(m_filepath);
if (region.is_executable())
builder.append(": .text");
builder.append(": .text"sv);
else
builder.append(": .rodata");
builder.append(": .rodata"sv);
// Now we can map the text segment at the reserved address.
auto* segment_base = (u8*)mmap_with_name(

View file

@ -41,7 +41,7 @@ void DynamicObject::dump() const
{
if constexpr (DYNAMIC_LOAD_DEBUG) {
StringBuilder builder;
builder.append("\nd_tag tag_name value\n");
builder.append("\nd_tag tag_name value\n"sv);
size_t num_dynamic_sections = 0;
for_each_dynamic_entry([&](DynamicObject::DynamicEntry const& entry) {

View file

@ -60,7 +60,7 @@ void Image::dump() const
return;
}
dbgln(" type: {}", ELF::Image::object_file_type_to_string(header().e_type).value_or("(?)"));
dbgln(" type: {}", ELF::Image::object_file_type_to_string(header().e_type).value_or("(?)"sv));
dbgln(" machine: {}", header().e_machine);
dbgln(" entry: {:x}", header().e_entry);
dbgln(" shoff: {}", header().e_shoff);