diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-12-28 09:38:41 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-28 01:55:22 -0800 |
commit | 52beeebe701d5633562cb7929cf1a39b7a05887f (patch) | |
tree | 275d896642d7949ff3feb2d21dc2d3b1219ca8c7 /Kernel/Net | |
parent | 7d6058415e371561d9dbfa7b68081680a0a3e4c1 (diff) | |
download | serenity-52beeebe701d5633562cb7929cf1a39b7a05887f.zip |
Kernel: Remove the KString::try_create(String::formatted(...)) pattern
We can now directly create formatted KStrings with KString::formatted.
:^)
Diffstat (limited to 'Kernel/Net')
-rw-r--r-- | Kernel/Net/NetworkingManagement.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Kernel/Net/NetworkingManagement.cpp b/Kernel/Net/NetworkingManagement.cpp index 87ce7c2bb8..1c91b0dac0 100644 --- a/Kernel/Net/NetworkingManagement.cpp +++ b/Kernel/Net/NetworkingManagement.cpp @@ -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 |