summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-08-27 11:16:52 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-08-27 15:52:26 +0900
commitae2dc3f217ba9f181471f39a7e5ce72a28b27c2a (patch)
treee506115b9dd5c2adb07946763506a5b46d36b5f0 /io.c
parent78628618da98236fc1bf702079185b36ed394e2a (diff)
rb_define_hooked_variable now free from ANYARGS
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit uses rb_gvar_getter_t / rb_gvar_setter_t for rb_define_hooked_variable / rb_define_virtual_variable which revealed lots of function prototype inconsistencies. Some of them were literally decades old, going back to dda5dc00cff334cac373096d444a0fd59e716124.
Diffstat (limited to 'io.c')
-rw-r--r--io.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/io.c b/io.c
index 1b37723b26..2f9df89d6a 100644
--- a/io.c
+++ b/io.c
@@ -12986,6 +12986,18 @@ rb_readwrite_syserr_fail(enum rb_io_wait_readwrite writable, int n, const char *
}
}
+static VALUE
+get_$LAST_READ_LINE(ID _x, VALUE *_y)
+{
+ return rb_lastline_get();
+}
+
+static void
+set_$LAST_READ_LINE(VALUE val, ID _x, VALUE *_y)
+{
+ rb_lastline_set(val);
+}
+
/*
* Document-class: IOError
*
@@ -13259,7 +13271,7 @@ Init_IO(void)
rb_define_hooked_variable("$-0", &rb_rs, 0, rb_str_setter);
rb_define_hooked_variable("$\\", &rb_output_rs, 0, rb_str_setter);
- rb_define_virtual_variable("$_", rb_lastline_get, rb_lastline_set);
+ rb_define_virtual_variable("$_", get_$LAST_READ_LINE, set_$LAST_READ_LINE);
rb_define_method(rb_cIO, "initialize_copy", rb_io_init_copy, 1);
rb_define_method(rb_cIO, "reopen", rb_io_reopen, -1);