1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-03 01:52:13 +00:00

Kernel: Remove the KString::try_create(String::formatted(...)) pattern

We can now directly create formatted KStrings with KString::formatted.

:^)
This commit is contained in:
Daniel Bertalan 2021-12-28 09:38:41 +01:00 committed by Brian Gianforcaro
parent 7d6058415e
commit 52beeebe70
11 changed files with 18 additions and 35 deletions

View file

@ -18,8 +18,7 @@ namespace Kernel {
ErrorOr<NonnullRefPtr<MasterPTY>> MasterPTY::try_create(unsigned int index)
{
// FIXME: Don't make a temporary String here
auto pts_name = TRY(KString::try_create(String::formatted("/dev/pts/{}", index)));
auto pts_name = TRY(KString::formatted("/dev/pts/{}", index));
auto tty_name = TRY(pts_name->try_clone());
auto buffer = TRY(DoubleBuffer::try_create());
@ -133,8 +132,7 @@ ErrorOr<void> MasterPTY::ioctl(OpenFileDescription& description, unsigned reques
ErrorOr<NonnullOwnPtr<KString>> MasterPTY::pseudo_path(const OpenFileDescription&) const
{
// FIXME: Replace this and others of this pattern by KString::formatted()
return KString::try_create(String::formatted("ptm:{}", m_pts_name));
return KString::formatted("ptm:{}", m_pts_name);
}
}