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

Add a String::format() and use that in place of ksprintf() in the Kernel.

You're never gonna be right 100% of the time when guessing how much buffer
space you need. This avoids having to make that type of decision in a bunch
of cases. :^)
This commit is contained in:
Andreas Kling 2019-01-30 16:28:51 +01:00
parent e9b948103d
commit 027d26cd5d
11 changed files with 40 additions and 34 deletions

View file

@ -205,15 +205,11 @@ char* ELFLoader::symbol_ptr(const char* name)
bool ELFLoader::allocate_section(LinearAddress laddr, size_t size, size_t alignment, bool is_readable, bool is_writable)
{
ASSERT(alloc_section_hook);
char namebuf[16];
ksprintf(namebuf, "elf-alloc-%s%s", is_readable ? "r" : "", is_writable ? "w" : "");
return alloc_section_hook(laddr, size, alignment, is_readable, is_writable, namebuf);
return alloc_section_hook(laddr, size, alignment, is_readable, is_writable, String::format("elf-alloc-%s%s", is_readable ? "r" : "", is_writable ? "w" : ""));
}
bool ELFLoader::map_section(LinearAddress laddr, size_t size, size_t alignment, size_t offset_in_image, bool is_readable, bool is_writable)
{
ASSERT(alloc_section_hook);
char namebuf[16];
ksprintf(namebuf, "elf-map-%s%s", is_readable ? "r" : "", is_writable ? "w" : "");
return map_section_hook(laddr, size, alignment, offset_in_image, is_readable, is_writable, namebuf);
return map_section_hook(laddr, size, alignment, offset_in_image, is_readable, is_writable, String::format("elf-map-%s%s", is_readable ? "r" : "", is_writable ? "w" : ""));
}