diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-03-14 12:38:16 +0900 |
---|---|---|
committer | git <[email protected]> | 2024-03-14 03:49:38 +0000 |
commit | 5fe1853e9b483c4ad4d55063727299b9659c137b (patch) | |
tree | 404ec7b5ff28590d156116e18ff71c694ca957cc | |
parent | d49b41566b5fea30e954d1661855ba702206ac56 (diff) |
[ruby/fcntl] Reduce duplicate `O_ACCMODE` definitions
https://github.com/ruby/fcntl/commit/6a6442a7f8
-rw-r--r-- | ext/fcntl/fcntl.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c index 950d4e6908..eae380d0f7 100644 --- a/ext/fcntl/fcntl.c +++ b/ext/fcntl/fcntl.c @@ -225,17 +225,13 @@ Init_fcntl(void) */ rb_define_const(mFcntl, "O_WRONLY", INT2NUM(O_WRONLY)); #endif -#ifdef O_ACCMODE +#ifndef O_ACCMODE + int O_ACCMODE = (O_RDONLY | O_WRONLY | O_RDWR); +#endif /* * Mask to extract the read/write flags */ rb_define_const(mFcntl, "O_ACCMODE", INT2FIX(O_ACCMODE)); -#else - /* - * Mask to extract the read/write flags - */ - rb_define_const(mFcntl, "O_ACCMODE", INT2FIX(O_RDONLY | O_WRONLY | O_RDWR)); -#endif #ifdef F_DUP2FD /* * It is a FreeBSD specific constant and equivalent |