mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 06:25:07 +00:00
Kernel: Add KString::must_{..} factory methods
There are a bunch of places like drivers which for all intense and purposes can't really fail allocation during boot, and if they do fail we should crash immediately. This change adds `KString::must_create_uninitialized(..)` as well as `KString::must_create(..)` for use during early boot initialization of the Kernel. They enforce that they are only used during early boot.
This commit is contained in:
parent
de0aa44bb6
commit
d838a02e74
3 changed files with 27 additions and 0 deletions
|
@ -14,7 +14,9 @@ namespace Kernel {
|
|||
class KString {
|
||||
public:
|
||||
static OwnPtr<KString> try_create_uninitialized(size_t, char*&);
|
||||
static NonnullOwnPtr<KString> must_create_uninitialized(size_t, char*&);
|
||||
static OwnPtr<KString> try_create(StringView const&);
|
||||
static NonnullOwnPtr<KString> must_create(StringView const&);
|
||||
|
||||
OwnPtr<KString> try_clone() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue