summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-06-02 21:07:50 +0900
committerYukihiro Matsumoto <[email protected]>2012-06-02 21:07:50 +0900
commit3e9fc0b013ae0715aa5ff91e298d1baf3ca87bae (patch)
tree1472b05608936c85e3516154a1b89e80b2834ad6
parentca4de06e60c684fca8892623c18631165f191442 (diff)
downloadmruby-3e9fc0b013ae0715aa5ff91e298d1baf3ca87bae.tar.gz
mruby-3e9fc0b013ae0715aa5ff91e298d1baf3ca87bae.zip
add proper type check (using mrb_get_args) in Array#replace
-rw-r--r--src/array.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/array.c b/src/array.c
index 27e8e9aba..4126cc7b5 100644
--- a/src/array.c
+++ b/src/array.c
@@ -261,10 +261,11 @@ mrb_ary_replace(mrb_state *mrb, struct RArray *a, mrb_value *argv, size_t len)
mrb_value
mrb_ary_replace_m(mrb_state *mrb, mrb_value self)
{
- mrb_value other;
+ mrb_value *buf;
+ int blen;
- mrb_get_args(mrb, "o", &other);
- mrb_ary_replace(mrb, mrb_ary_ptr(self), RARRAY_PTR(other), RARRAY_LEN(other));
+ mrb_get_args(mrb, "a", &buf, &blen);
+ mrb_ary_replace(mrb, mrb_ary_ptr(self), buf, blen);
return self;
}