mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +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:
@@ -292,16 +292,10 @@ String FileDescriptor::absolute_path()
|
||||
Stopwatch sw("absolute_path");
|
||||
if (is_tty())
|
||||
return tty()->tty_name();
|
||||
if (is_fifo()) {
|
||||
char buf[32];
|
||||
ksprintf(buf, "fifo:%x", m_fifo.ptr());
|
||||
return buf;
|
||||
}
|
||||
if (is_character_device()) {
|
||||
char buf[128];
|
||||
ksprintf(buf, "device:%u,%u (%s)", m_device->major(), m_device->minor(), m_device->class_name());
|
||||
return buf;
|
||||
}
|
||||
if (is_fifo())
|
||||
return String::format("fifo:%x", m_fifo.ptr());
|
||||
if (is_character_device())
|
||||
return String::format("device:%u,%u (%s)", m_device->major(), m_device->minor(), m_device->class_name());
|
||||
ASSERT(m_inode);
|
||||
return VFS::the().absolute_path(*m_inode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user