Expose enum rb_io_event flags without _t suffix. (#7887)

This commit is contained in:
Samuel Williams 2023-06-01 22:54:08 +09:00 committed by GitHub
parent 47a8de6095
commit b7ee51e81d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-06-01 13:54:38 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>
2 changed files with 6 additions and 4 deletions

View File

@ -78,11 +78,13 @@ RUBY_EXTERN VALUE rb_eIOTimeoutError;
*
* This is visible from extension libraries because `io/wait` wants it.
*/
typedef enum {
enum rb_io_event {
RUBY_IO_READABLE = RB_WAITFD_IN, /**< `IO::READABLE` */
RUBY_IO_WRITABLE = RB_WAITFD_OUT, /**< `IO::WRITABLE` */
RUBY_IO_PRIORITY = RB_WAITFD_PRI, /**< `IO::PRIORITY` */
} rb_io_event_t;
};
typedef enum rb_io_event rb_io_event_t;
/**
* IO buffers. This is an implementation detail of ::rb_io_t::wbuf and

4
io.c
View File

@ -9785,7 +9785,7 @@ wait_mode_sym(VALUE mode)
rb_raise(rb_eArgError, "unsupported mode: %"PRIsVALUE, mode);
}
static inline rb_io_event_t
static inline enum rb_io_event
io_event_from_value(VALUE value)
{
int events = RB_NUM2INT(value);
@ -9816,7 +9816,7 @@ static VALUE
io_wait(int argc, VALUE *argv, VALUE io)
{
VALUE timeout = Qundef;
rb_io_event_t events = 0;
enum rb_io_event events = 0;
int return_io = 0;
// The documented signature for this method is actually incorrect.