LibELF: Convert String::format() to String::formatted()

This commit is contained in:
Andreas Kling 2021-01-25 12:08:57 +01:00
parent eb354b7ce8
commit a5de46684b
Notes: sideshowbarker 2024-07-18 22:52:06 +09:00
3 changed files with 5 additions and 5 deletions

View file

@ -100,7 +100,7 @@ static void map_library(const String& name, int fd)
static void map_library(const String& name)
{
// TODO: Do we want to also look for libs in other paths too?
String path = String::format("/usr/lib/%s", name.characters());
String path = String::formatted("/usr/lib/{}", name);
int fd = open(path.characters(), O_RDONLY);
ASSERT(fd >= 0);
map_library(name, fd);

View file

@ -58,7 +58,7 @@ void* DynamicLoader::do_mmap(int fd, size_t size, const String& name)
if (size < sizeof(Elf32_Ehdr))
return MAP_FAILED;
String file_mmap_name = String::format("ELF_DYN: %s", name.characters());
String file_mmap_name = String::formatted("ELF_DYN: {}", name);
return mmap_with_name(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0, file_mmap_name.characters());
}
@ -276,7 +276,7 @@ void DynamicLoader::load_program_headers()
MAP_SHARED,
m_image_fd,
region->offset(),
String::format("%s: .text", m_filename.characters()).characters());
String::formatted("{}: .text", m_filename).characters());
if (MAP_FAILED == text_segment_begin) {
ASSERT_NOT_REACHED();
}
@ -297,7 +297,7 @@ void DynamicLoader::load_program_headers()
MAP_ANONYMOUS | MAP_PRIVATE,
0,
0,
String::format("%s: .data", m_filename.characters()).characters());
String::formatted("{}: .data", m_filename).characters());
if (MAP_FAILED == data_segment_begin) {
ASSERT_NOT_REACHED();
}

View file

@ -64,7 +64,7 @@ void DynamicObject::dump() const
size_t num_dynamic_sections = 0;
for_each_dynamic_entry([&](const DynamicObject::DynamicEntry& entry) {
String name_field = String::format("(%s)", name_for_dtag(entry.tag()));
String name_field = String::formatted("({})", name_for_dtag(entry.tag()));
builder.appendf("0x%08X %-17s0x%X\n", entry.tag(), name_field.characters(), entry.val());
num_dynamic_sections++;
return IterationDecision::Continue;