1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +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

@ -17,11 +17,9 @@ NonnullRefPtr<RamdiskDevice> RamdiskDevice::create(const RamdiskController& cont
{
// FIXME: Try to not hardcode a maximum of 16 partitions per drive!
size_t drive_index = minor / 16;
// FIXME: We need a way of formatting strings with KString!
auto device_name = String::formatted("ramdisk{}", drive_index);
auto device_name_kstring = KString::must_create(device_name.view());
auto device_name = MUST(KString::formatted("ramdisk{}", drive_index));
auto device_or_error = DeviceManagement::try_create_device<RamdiskDevice>(controller, move(region), major, minor, move(device_name_kstring));
auto device_or_error = DeviceManagement::try_create_device<RamdiskDevice>(controller, move(region), major, minor, move(device_name));
// FIXME: Find a way to propagate errors
VERIFY(!device_or_error.is_error());
return device_or_error.release_value();