From f0a64329b1cb8156e0d525d003e5d6ff03b7832f Mon Sep 17 00:00:00 2001 From: dearblue Date: Thu, 22 Oct 2020 22:55:35 +0900 Subject: Prohibit array changes by "a"/"*" specifier of `mrb_get_args()` The "a"/"*" specifier of the `mrb_get_args()` function will now return `const mrb_value *`. This is because it is difficult for the caller to check if it is an array object and write-barrier if necessary. And it requires calling `mrb_ary_modify()` on the unmodified array object, which is also difficult (this is similar to #5087). --- mrbgems/mruby-io/src/file.c | 4 ++-- mrbgems/mruby-io/src/io.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'mrbgems/mruby-io') diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c index d272cab7d..ab325195c 100644 --- a/mrbgems/mruby-io/src/file.c +++ b/mrbgems/mruby-io/src/file.c @@ -115,7 +115,7 @@ mrb_file_s_umask(mrb_state *mrb, mrb_value klass) static mrb_value mrb_file_s_unlink(mrb_state *mrb, mrb_value obj) { - mrb_value *argv; + const mrb_value *argv; mrb_value pathv; mrb_int argc, i; char *path; @@ -533,7 +533,7 @@ static mrb_value mrb_file_s_chmod(mrb_state *mrb, mrb_value klass) { mrb_int mode; mrb_int argc, i; - mrb_value *filenames; + const mrb_value *filenames; int ai = mrb_gc_arena_save(mrb); mrb_get_args(mrb, "i*", &mode, &filenames, &argc); diff --git a/mrbgems/mruby-io/src/io.c b/mrbgems/mruby-io/src/io.c index 0fa0f34b1..d4505e4f7 100644 --- a/mrbgems/mruby-io/src/io.c +++ b/mrbgems/mruby-io/src/io.c @@ -1154,7 +1154,7 @@ mrb_io_s_pipe(mrb_state *mrb, mrb_value klass) static mrb_value mrb_io_s_select(mrb_state *mrb, mrb_value klass) { - mrb_value *argv; + const mrb_value *argv; mrb_int argc; mrb_value read, read_io, write, except, timeout, list; struct timeval *tp, timerec; -- cgit v1.2.3