mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-14 18:30:38 +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: https://github.com/SerenityOS/serenity/commit/1d843c46eb6 Pull-request: https://github.com/SerenityOS/serenity/pull/5263
1 changed files with 4 additions and 2 deletions
|
@ -172,8 +172,10 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
union {
|
||||
alignas(T) char m_storage[sizeof(T)];
|
||||
KResult m_error;
|
||||
};
|
||||
bool m_is_error { false };
|
||||
bool m_have_storage { false };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue