mruby-io/io.c: define seek constants in C
From C macro definitions instead of literal integers (may differ from
the platform's definitions).
SEEK_SET
SEEK_CUR
SEEK_END
MODIFY
mrbgems/mruby-io/mrblib/io.rb
mrbgems/mruby-io/mrblib/io.rb
@@ -5,10 +5,6 @@ class IOError < StandardError; end
class EOFError < IOError; end
class IO
- SEEK_SET = 0
- SEEK_CUR = 1
- SEEK_END = 2
-
def self.open(*args, &block)
io = self.new(*args)

MODIFY
mrbgems/mruby-io/src/io.c
mrbgems/mruby-io/src/io.c
@@ -1578,6 +1578,10 @@ mrb_init_io(mrb_state *mrb)
mrb_define_method(mrb, io, "pread", mrb_io_pread, MRB_ARGS_ANY()); /* ruby 2.5 feature */
mrb_define_method(mrb, io, "pwrite", mrb_io_pwrite, MRB_ARGS_ANY()); /* ruby 2.5 feature */
+ mrb_define_const_id(mrb, io, MRB_SYM(SEEK_SET), mrb_fixnum_value(SEEK_SET));
+ mrb_define_const_id(mrb, io, MRB_SYM(SEEK_CUR), mrb_fixnum_value(SEEK_CUR));
+ mrb_define_const_id(mrb, io, MRB_SYM(SEEK_END), mrb_fixnum_value(SEEK_END));
+
mrb_define_method(mrb, io, "_read_buf", mrb_io_read_buf, MRB_ARGS_NONE());
mrb_define_method(mrb, io, "_readchar", mrb_io_readchar, MRB_ARGS_NONE());
mrb_define_class_method(mrb, io, "_bufread", mrb_io_bufread, MRB_ARGS_REQ(2));

mruby-io/io.c: define seek constants in C

From C macro definitions instead of literal integers (may differ from
the platform's definitions).

- SEEK_SET
- SEEK_CUR
- SEEK_END