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

@ -78,10 +78,9 @@ ErrorOr<NonnullOwnPtr<KString>> NetworkingManagement::generate_interface_name_fr
{
VERIFY(device_identifier.class_code().value() == 0x2);
// Note: This stands for e - "Ethernet", p - "Port" as for PCI bus, "s" for slot as for PCI slot
auto name = String::formatted("ep{}s{}", device_identifier.address().bus(), device_identifier.address().device());
VERIFY(!NetworkingManagement::the().lookup_by_name(name));
// TODO: We need some way to to format data into a `KString`.
return KString::try_create(name.view());
auto name = TRY(KString::formatted("ep{}s{}", device_identifier.address().bus(), device_identifier.address().device()));
VERIFY(!NetworkingManagement::the().lookup_by_name(name->view()));
return name;
}
UNMAP_AFTER_INIT RefPtr<NetworkAdapter> NetworkingManagement::determine_network_device(PCI::DeviceIdentifier const& device_identifier) const