mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
Kernel/VirtIO: Don't expose constructors as public method
This leads to a bad pattern where anyone could create an RNG or a Console object. Instead, let's just use the common pattern of a static method to instantiate a new object and return it wrapped by a NonnullRefPtr.
This commit is contained in:
parent
01ae614727
commit
8e90a4fd1c
Notes:
sideshowbarker
2024-07-18 04:59:47 +09:00
Author: https://github.com/supercomputer7
Commit: 8e90a4fd1c
Pull-request: https://github.com/SerenityOS/serenity/pull/9631
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/ccapitalK ✅
5 changed files with 16 additions and 5 deletions
|
@ -9,6 +9,11 @@
|
|||
|
||||
namespace Kernel::VirtIO {
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<RNG> RNG::must_create(PCI::Address address)
|
||||
{
|
||||
return adopt_ref_if_nonnull(new RNG(address)).release_nonnull();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT RNG::RNG(PCI::Address address)
|
||||
: VirtIO::Device(address)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue