mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-19 07:49:05 +00:00
Kernel: KResultOr can use the same storage as the object for the error
Since it can only hold either an object or an error code, we can share the same storage to hold either.
This commit is contained in:
parent
79bab28f5e
commit
1d843c46eb
Notes:
sideshowbarker
2024-07-18 22:31:28 +09:00
Author: https://github.com/tomuta
Commit: 1d843c46eb
Pull-request: https://github.com/SerenityOS/serenity/pull/5263
1 changed files with 4 additions and 2 deletions
|
@ -172,8 +172,10 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
alignas(T) char m_storage[sizeof(T)];
|
||||
KResult m_error;
|
||||
union {
|
||||
alignas(T) char m_storage[sizeof(T)];
|
||||
KResult m_error;
|
||||
};
|
||||
bool m_is_error { false };
|
||||
bool m_have_storage { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue