1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:47:35 +00:00

LibC: Make errno codes be #defines instead of enum values.

It turns out that a lot of 3rd party software does things like:

    #ifdef EINTR
        ...
    #endif

This won't work if EINTR is an enum. So much for that nice idea.
This commit is contained in:
Andreas Kling 2019-02-26 22:40:35 +01:00
parent 83e78648e4
commit 424368034b
4 changed files with 146 additions and 87 deletions

View file

@ -7,7 +7,6 @@ enum KSuccessTag { KSuccess };
class KResult {
public:
explicit KResult(__errno_value e) : m_error(-e) { }
explicit KResult(int negative_e) : m_error(negative_e) { ASSERT(negative_e <= 0); }
KResult(KSuccessTag) : m_error(0) { }
operator int() const { return m_error; }