mruby-io/io.c: forgot to rename `mrb_io_pread` on non-Unix platforms
MODIFY
mrbgems/mruby-io/mrblib/io.rb
mrbgems/mruby-io/mrblib/io.rb
@@ -86,17 +86,6 @@ class IO
self.__id__
end
- def write(string)
- str = string.is_a?(String) ? string : string.to_s
- return 0 if str.empty?
- unless @buf.empty?
- # reset real pos ignore buf
- seek(pos, SEEK_SET)
- end
- len = syswrite(str)
- len
- end
-
def <<(str)
write(str)
self

MODIFY
mrbgems/mruby-io/src/io.c
mrbgems/mruby-io/src/io.c
@@ -1414,8 +1414,8 @@ io_sync(mrb_state *mrb, mrb_value self)
}
#ifndef MRB_WITH_IO_PREAD_PWRITE
-# define mrb_io_pread mrb_notimplement_m
-# define mrb_io_pwrite mrb_notimplement_m
+# define io_pread mrb_notimplement_m
+# define io_pwrite mrb_notimplement_m
#else
static off_t
value2off(mrb_state *mrb, mrb_value offv)
@@ -1537,6 +1537,22 @@ io_readchar(mrb_state *mrb, mrb_value self)
return io_bufread(mrb, buf, len);
}
+ /* def write(string) */
+ /* str = string.is_a?(String) ? string : string.to_s */
+ /* return 0 if str.empty? */
+ /* unless @buf.empty? */
+ /* # reset real pos ignore buf */
+ /* seek(pos, SEEK_SET) */
+ /* end */
+ /* len = syswrite(str) */
+ /* len */
+ /* end */
+
+static mrb_value
+io_write(mrb_state *mrb, mrb_value self)
+{
+}
+
void
mrb_init_io(mrb_state *mrb)
{
@@ -1571,6 +1587,7 @@ mrb_init_io(mrb_state *mrb)
mrb_define_method(mrb, io, "closed?", io_closed, MRB_ARGS_NONE()); /* 15.2.20.5.2 */
mrb_define_method(mrb, io, "pid", io_pid, MRB_ARGS_NONE()); /* 15.2.20.5.2 */
mrb_define_method(mrb, io, "fileno", io_fileno, MRB_ARGS_NONE());
+ mrb_define_method(mrb, io, "write", io_write, MRB_ARGS_ANY());
mrb_define_method(mrb, io, "pread", io_pread, MRB_ARGS_ANY()); /* ruby 2.5 feature */
mrb_define_method(mrb, io, "pwrite", io_pwrite, MRB_ARGS_ANY()); /* ruby 2.5 feature */

mruby-io/io.c: forgot to rename `mrb_io_pread` on non-Unix platforms