diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-24 01:09:36 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-24 01:09:36 +0900 |
| commit | ad9e841c5359efdd37a132767e03ad7a2d5ae72e (patch) | |
| tree | 8e60edf2dce29e86d8b47d0b2e8dc8a2a2329ded /src/array.c | |
| parent | 4f012f578f22cca67af8c633845464abc79913f4 (diff) | |
| download | mruby-ad9e841c5359efdd37a132767e03ad7a2d5ae72e.tar.gz mruby-ad9e841c5359efdd37a132767e03ad7a2d5ae72e.zip | |
made mrb_get_args() better (optinal args, type checks); close #173 #176
Diffstat (limited to 'src/array.c')
| -rw-r--r-- | src/array.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/array.c b/src/array.c index 6ec20d673..37f1474df 100644 --- a/src/array.c +++ b/src/array.c @@ -177,10 +177,7 @@ mrb_ary_concat_m(mrb_state *mrb, mrb_value self) { mrb_value other; - mrb_get_args(mrb, "o", &other); - if (mrb_type(other) != MRB_TT_ARRAY) { - mrb_raise(mrb, E_ARGUMENT_ERROR, "expected Array"); - } + mrb_get_args(mrb, "A", &other); mrb_ary_concat(mrb, self, other); return self; } @@ -193,11 +190,7 @@ mrb_ary_plus(mrb_state *mrb, mrb_value self) mrb_value other; mrb_value ary; - mrb_get_args(mrb, "o", &other); - if (mrb_type(other) != MRB_TT_ARRAY) { - mrb_raise(mrb, E_ARGUMENT_ERROR, "expected Array"); - } - + mrb_get_args(mrb, "A", &other); ary = mrb_ary_new_capa(mrb, a1->len + RARRAY_LEN(other)); a2 = mrb_ary_ptr(ary); memcpy(a2->buf, a1->buf, sizeof(mrb_value)*a1->len); |
