mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 03:39:17 +00:00
Kernel/Net: Don't allocate memory for adapters' names
Instead, use a FixedStringBuffer to store a string with up to 16 chars.
This commit is contained in:
parent
b2fd51f561
commit
3f63be949a
Notes:
sideshowbarker
2024-07-17 06:00:02 +09:00
Author: https://github.com/supercomputer7
Commit: 3f63be949a
Pull-request: https://github.com/SerenityOS/serenity/pull/20506
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
14 changed files with 40 additions and 40 deletions
|
@ -13,12 +13,11 @@ static bool s_loopback_initialized = false;
|
|||
|
||||
ErrorOr<NonnullRefPtr<LoopbackAdapter>> LoopbackAdapter::try_create()
|
||||
{
|
||||
auto interface_name = TRY(KString::try_create("loop"sv));
|
||||
return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LoopbackAdapter(move(interface_name))));
|
||||
return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LoopbackAdapter("loop"sv)));
|
||||
}
|
||||
|
||||
LoopbackAdapter::LoopbackAdapter(NonnullOwnPtr<KString> interface_name)
|
||||
: NetworkAdapter(move(interface_name))
|
||||
LoopbackAdapter::LoopbackAdapter(StringView interface_name)
|
||||
: NetworkAdapter(interface_name)
|
||||
{
|
||||
VERIFY(!s_loopback_initialized);
|
||||
s_loopback_initialized = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue