summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2023-06-01 22:54:08 +0900
committerGitHub <noreply@github.com>2023-06-01 22:54:08 +0900
commitb7ee51e81dd63990ec27daaa151864214cbf85d2 (patch)
treef410c597ed195d6bdb158346cec2f24c810794ec
parent47a8de609595def385cb8c716b80d7a64b718310 (diff)
Expose `enum rb_io_event` flags without `_t` suffix. (#7887)
Notes
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
-rw-r--r--include/ruby/io.h6
-rw-r--r--io.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/include/ruby/io.h b/include/ruby/io.h
index bc672082c9..9b381fc9bb 100644
--- a/include/ruby/io.h
+++ b/include/ruby/io.h
@@ -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
diff --git a/io.c b/io.c
index ddac22d37f..772aa8fe1e 100644
--- a/io.c
+++ b/io.c
@@ -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.